/* shadcn/ui · port vanilla per Travel Crafters CRM
   Riproduce markup, token e comportamento dei componenti di https://ui.shadcn.com
   (Button, Input, Textarea, Label, Select, Checkbox, Radio Group, Switch, Calendar + Date Picker, Popover,
   Dropdown Menu, Dialog, Tabs, Badge, Accordion, Combobox, Tooltip, Progress, Kbd, Sonner), con i colori Oreko. */

:root{
  --sh-radius:.5rem;
  --sh-background:var(--bg);
  --sh-foreground:var(--text);
  --sh-card:var(--surface);
  --sh-popover:var(--surface);
  --sh-popover-foreground:var(--text);
  --sh-primary:#1c1d19;
  --sh-primary-foreground:#ffffff;
  --sh-secondary:var(--surface2);
  --sh-secondary-foreground:var(--text);
  --sh-muted:var(--surface2);
  --sh-muted-foreground:var(--muted);
  --sh-accent:#efeee8;
  --sh-accent-foreground:var(--text);
  --sh-destructive:#b65346;
  --sh-border:var(--border);
  --sh-input:#d4d3ca;
  --sh-ring:var(--accent);
  --sh-shadow-xs:0 1px 2px rgba(0,0,0,.06);
}
[data-theme=dark]{
  --sh-primary:#a6ad7a;
  --sh-primary-foreground:#202319;
  --sh-accent:#2b2d25;
  --sh-destructive:#c0675b;
  --sh-input:rgba(255,255,255,.14);
  --sh-shadow-xs:0 1px 2px rgba(0,0,0,.3);
}

/* Focus ring condiviso (focus-visible:ring-[3px] ring-ring/50) */
:where(button,[role=button],[role=combobox],[role=switch],[role=checkbox],[role=option],input,textarea,select,a):focus-visible{outline:none}
.btn:focus-visible,.icon-btn:focus-visible,.sh-select-trigger:focus-visible,.sh-date-trigger:focus-visible,.sh-time-trigger:focus-visible,.fs-switch:focus-visible,.seg:focus-visible,.input:focus-visible,.sh-day:focus-visible,.sh-calendar-nav:focus-visible{border-color:var(--sh-ring)!important;box-shadow:0 0 0 3px color-mix(in srgb,var(--sh-ring) 45%,transparent)!important}

/* Button */
.btn,.icon-btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;height:36px;padding:0 16px;border:1px solid var(--sh-input);border-radius:var(--sh-radius);background:transparent;color:var(--sh-foreground);font-size:14px;font-weight:500;line-height:1;white-space:nowrap;box-shadow:var(--sh-shadow-xs);transition:background-color .15s,color .15s,border-color .15s,box-shadow .15s;cursor:pointer}
[data-theme=dark] .btn:not(.primary):not(.light):not(.ghost):not(.danger-text):not(.danger-solid),[data-theme=dark] .icon-btn{background:rgba(255,255,255,.04)}
.btn:hover,.icon-btn:hover{background:var(--sh-accent);color:var(--sh-accent-foreground)}
.btn.primary{background:var(--sh-primary);color:var(--sh-primary-foreground);border-color:var(--sh-primary)}
.btn.primary:hover{background:color-mix(in srgb,var(--sh-primary) 90%,#fff);color:var(--sh-primary-foreground)}
.btn.sm{height:32px;padding:0 12px;gap:6px;font-size:13px}
.btn.ghost{background:transparent;border-color:transparent;box-shadow:none}
.btn.danger-text{background:transparent;border-color:transparent;box-shadow:none;color:var(--sh-destructive)}
.btn.danger-text:hover{background:color-mix(in srgb,var(--sh-destructive) 14%,transparent)}
.btn.danger-solid{background:var(--sh-destructive);border-color:var(--sh-destructive);color:#fff}
.btn[disabled],.icon-btn[disabled]{opacity:.5;pointer-events:none}
.icon-btn{width:36px;padding:0}
.btn svg,.icon-btn svg{width:16px;height:16px;flex:0 0 auto}
.btn.light{background:#f4f3ec;border-color:#f4f3ec;color:#1c1d19}
.tc-dark-actions .btn.light{background:#1c1d19;border-color:#1c1d19;color:#fff}
.tc-dark-actions .btn.ghost{background:rgba(255,255,255,.55);border-color:transparent;color:#202319}

/* Input · Textarea · Label */
.input,.act-form .input,.auth-form .input,.auth-form-grid .input,.form-grid .input,.settings-content .input,.help-search .input{height:36px!important;min-height:36px!important;padding:4px 12px!important;border:1px solid var(--sh-input)!important;border-radius:var(--sh-radius)!important;background:transparent!important;color:var(--sh-foreground)!important;font-size:14px!important;line-height:1.4;box-shadow:var(--sh-shadow-xs)!important;transition:border-color .15s,box-shadow .15s}
[data-theme=dark] .input,[data-theme=dark] .act-form .input,[data-theme=dark] .auth-form .input,[data-theme=dark] .auth-form-grid .input,[data-theme=dark] .form-grid .input,[data-theme=dark] .settings-content .input{background:rgba(255,255,255,.04)!important}
textarea.input,.act-form textarea.input{height:auto!important;min-height:76px!important;padding:8px 12px!important}
.input::placeholder{color:var(--sh-muted-foreground);opacity:1}
.input:focus-visible,.input:focus{border-color:var(--sh-ring)!important;box-shadow:0 0 0 3px color-mix(in srgb,var(--sh-ring) 45%,transparent)!important;outline:none}
.input.invalid,.settings-invalid,.invalid{border-color:var(--sh-destructive)!important}
.input.invalid:focus-visible,.settings-invalid:focus-visible{box-shadow:0 0 0 3px color-mix(in srgb,var(--sh-destructive) 35%,transparent)!important}
input[type=search]::-webkit-search-cancel-button{display:none}
.act-field label,.field label,.auth-form label,.fs-form label,.dialog-label{font-size:14px;font-weight:500;line-height:1;color:var(--sh-foreground)}
.act-error,.settings-error,.auth-otp-error{color:var(--sh-destructive)}

/* Select */
.sh-native{position:absolute!important;width:1px!important;height:1px!important;opacity:0!important;pointer-events:none!important;margin:0!important;padding:0!important;border:0!important;overflow:hidden!important;clip:rect(0 0 0 0)!important}
.sh-select-trigger,.sh-date-trigger,.sh-time-trigger{display:flex;align-items:center;justify-content:space-between;gap:8px;width:100%;height:36px;padding:0 12px;border:1px solid var(--sh-input);border-radius:var(--sh-radius);background:transparent;color:var(--sh-foreground);font:inherit;font-size:14px;text-align:left;white-space:nowrap;box-shadow:var(--sh-shadow-xs);cursor:pointer;transition:border-color .15s,box-shadow .15s}
[data-theme=dark] .sh-select-trigger,[data-theme=dark] .sh-date-trigger,[data-theme=dark] .sh-time-trigger{background:rgba(255,255,255,.04)}
.sh-select-trigger:hover,.sh-date-trigger:hover,.sh-time-trigger:hover{background:var(--sh-accent)}
.sh-select-trigger.auto{width:auto;min-width:130px}
.sh-select-trigger[aria-expanded=true],.sh-date-trigger[aria-expanded=true],.sh-time-trigger[aria-expanded=true]{border-color:var(--sh-ring);box-shadow:0 0 0 3px color-mix(in srgb,var(--sh-ring) 45%,transparent)}
.sh-select-trigger.invalid,.sh-date-trigger.invalid,.sh-time-trigger.invalid{border-color:var(--sh-destructive)}
.sh-select-trigger[disabled],.sh-date-trigger[disabled],.sh-time-trigger[disabled]{opacity:.5;pointer-events:none}
.sh-select-value,.sh-trigger-text{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis}
.sh-placeholder{color:var(--sh-muted-foreground)}
.sh-chevron{width:16px;height:16px;opacity:.5;flex:0 0 auto}
.sh-leading{width:16px;height:16px;opacity:.7;flex:0 0 auto}
.sh-date-trigger,.sh-time-trigger{justify-content:flex-start}
.sh-popover{position:fixed;z-index:400;border:1px solid var(--sh-border);border-radius:var(--sh-radius);background:var(--sh-popover);color:var(--sh-popover-foreground);box-shadow:0 10px 30px rgba(0,0,0,.28);animation:sh-in .12s ease-out;max-width:calc(100vw - 16px)}
@keyframes sh-in{from{opacity:0;transform:translateY(-3px) scale(.98)}to{opacity:1;transform:none}}
.sh-select-content{padding:4px;overflow-y:auto;outline:none}
.sh-select-item{position:relative;display:flex;align-items:center;gap:8px;width:100%;padding:6px 32px 6px 8px;border-radius:6px;font-size:14px;cursor:default;user-select:none;outline:none}
.sh-select-item[data-highlighted],.sh-select-item:hover{background:var(--sh-accent);color:var(--sh-accent-foreground)}
.sh-select-item[aria-disabled=true]{opacity:.5;pointer-events:none}
.sh-select-check{position:absolute;right:8px;width:14px;height:14px;display:none}
.sh-select-item[aria-selected=true] .sh-select-check{display:block}

/* Combobox (Popover + Command) */
.sh-command{padding:4px;max-height:260px;overflow-y:auto}
.sh-command-empty{padding:12px 8px;text-align:center;font-size:13px;color:var(--sh-muted-foreground)}

/* Calendar + Date Picker */
.sh-calendar{padding:12px;width:fit-content}
.sh-calendar-head{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:8px}
.sh-calendar-title{flex:1;text-align:center;font-size:14px;font-weight:500}
.sh-calendar-nav{display:grid;place-items:center;width:28px;height:28px;padding:0;border:1px solid var(--sh-input);border-radius:6px;background:transparent;color:var(--sh-foreground);cursor:pointer}
.sh-calendar-nav:hover{background:var(--sh-accent)}
.sh-calendar-nav svg{width:16px;height:16px}
.sh-calendar-grid{display:grid;grid-template-columns:repeat(7,32px);gap:2px}
.sh-weekday{display:grid;place-items:center;height:28px;font-size:12px;font-weight:400;color:var(--sh-muted-foreground)}
.sh-day{display:grid;place-items:center;width:32px;height:32px;padding:0;border:1px solid transparent;border-radius:6px;background:transparent;color:var(--sh-foreground);font:inherit;font-size:14px;font-variant-numeric:tabular-nums;cursor:pointer}
.sh-day:hover{background:var(--sh-accent)}
.sh-day.outside{color:var(--sh-muted-foreground);opacity:.55}
.sh-day.today{background:var(--sh-accent);color:var(--sh-accent-foreground)}
.sh-day[aria-selected=true]{background:var(--sh-primary);color:var(--sh-primary-foreground)}
.sh-day[disabled]{opacity:.35;pointer-events:none}
.sh-calendar-foot{display:flex;justify-content:flex-end;margin-top:8px;padding-top:8px;border-top:1px solid var(--sh-border)}
.sh-time{display:flex;gap:4px;padding:4px}
.sh-time-col{display:grid;align-content:start;gap:2px;max-height:240px;overflow-y:auto;padding:2px;min-width:64px}
.sh-time-col+.sh-time-col{border-left:1px solid var(--sh-border);padding-left:6px}
.sh-time-item{height:32px;border:0;border-radius:6px;background:transparent;color:var(--sh-foreground);font:inherit;font-size:14px;font-variant-numeric:tabular-nums;cursor:pointer}
.sh-time-item:hover{background:var(--sh-accent)}
.sh-time-item[aria-selected=true]{background:var(--sh-primary);color:var(--sh-primary-foreground)}

/* Checkbox · Radio Group */
.sh-check{position:relative;display:inline-grid;place-items:center;flex:0 0 auto;width:16px;height:16px;vertical-align:middle}
.sh-check>input{position:absolute;inset:0;width:100%;height:100%;margin:0;opacity:0;cursor:pointer;z-index:1}
.sh-check-box{display:grid;place-items:center;width:16px;height:16px;border:1px solid var(--sh-input);border-radius:4px;background:transparent;color:var(--sh-primary-foreground);box-shadow:var(--sh-shadow-xs);transition:background-color .15s,border-color .15s;pointer-events:none}
[data-theme=dark] .sh-check-box{background:rgba(255,255,255,.04)}
.sh-check-box svg{width:12px;height:12px;opacity:0}
.sh-check.radio .sh-check-box{border-radius:999px}
.sh-check.radio .sh-check-box i{width:8px;height:8px;border-radius:999px;background:var(--sh-primary);opacity:0}
.sh-check[data-state=checked] .sh-check-box{background:var(--sh-primary);border-color:var(--sh-primary)}
.sh-check[data-state=checked] .sh-check-box svg{opacity:1}
.sh-check.radio[data-state=checked] .sh-check-box{background:transparent}
.sh-check.radio[data-state=checked] .sh-check-box i{opacity:1}
.sh-check>input:focus-visible+.sh-check-box{border-color:var(--sh-ring);box-shadow:0 0 0 3px color-mix(in srgb,var(--sh-ring) 45%,transparent)}
.sh-check[data-disabled]{opacity:.5}

/* Switch */
.fs-switch{position:relative;display:inline-flex;align-items:center;flex:0 0 auto;width:32px;height:18px;padding:0;border:1px solid transparent;border-radius:999px;background:var(--sh-input);box-shadow:var(--sh-shadow-xs);transition:background-color .15s;cursor:pointer}
.fs-switch i{position:absolute;top:50%;left:1px;width:14px;height:14px;margin:0;border-radius:999px;background:var(--sh-background);transform:translate(0,-50%);transition:transform .15s}
[data-theme=dark] .fs-switch i{background:#e5e7d8}
.fs-switch.on,.fs-switch[aria-checked=true]{background:var(--sh-primary)}
.fs-switch.on i,.fs-switch[aria-checked=true] i{transform:translate(14px,-50%);background:var(--sh-primary-foreground)}

/* Tabs / Toggle group (segmented) */
.segmented{display:inline-flex;align-items:center;height:36px;padding:3px;border:0!important;border-radius:10px;background:var(--sh-muted)!important;gap:2px}
.segmented .seg{display:inline-flex;align-items:center;justify-content:center;height:30px;min-height:0!important;padding:0 12px;border:1px solid transparent;border-radius:7px;background:transparent;color:var(--sh-muted-foreground);font-size:13px;font-weight:500;white-space:nowrap;cursor:pointer;transition:background-color .15s,color .15s}
.segmented .seg:hover{color:var(--sh-foreground)}
.segmented .seg.active{background:var(--sh-background);color:var(--sh-foreground);box-shadow:var(--sh-shadow-xs)}
[data-theme=dark] .segmented .seg.active{background:rgba(255,255,255,.1);border-color:var(--sh-input)}
.calendar-toolbar .segmented{height:36px}

/* Badge */
.status{display:inline-flex;align-items:center;gap:4px;padding:2px 8px;border:1px solid transparent;border-radius:6px;font-size:12px;font-weight:500;line-height:1.4;white-space:nowrap}

/* Dialog */
.modal-backdrop{background:rgba(0,0,0,.5)!important;backdrop-filter:none!important}
.modal{border:1px solid var(--sh-border);border-radius:12px!important;background:var(--sh-background);color:var(--sh-foreground);box-shadow:0 20px 50px rgba(0,0,0,.4)!important}
.modal-head h2,.modal-head #dialog-title{font-size:18px;font-weight:600;line-height:1.1;letter-spacing:-.01em}
.modal-foot{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:8px}
.modal-head .icon-btn{width:32px;height:32px;border-color:transparent;box-shadow:none;background:transparent!important;opacity:.7}
.modal-head .icon-btn:hover{opacity:1;background:var(--sh-accent)!important}

/* Dropdown Menu / Popover */
.top-dd,.search-pop,.owner-menu,.cal-menu,.prop-menu,.comm-menu,.rep-menu,.header-dropdown{border:1px solid var(--sh-border);border-radius:10px;background:var(--sh-popover);color:var(--sh-popover-foreground)}
.owner-menu button,.cal-menu button,.prop-menu button,.comm-menu button,.rep-menu button,.top-dd-item{border-radius:6px}
.owner-menu button:hover,.cal-menu button:hover,.prop-menu button:hover,.comm-menu button:hover,.rep-menu button:hover,.top-dd-item:hover{background:var(--sh-accent)}

/* Accordion */
.sh-accordion{display:grid}
.sh-accordion-item{border-bottom:1px solid var(--sh-border)}
.sh-accordion-item:last-child{border-bottom:0}
.sh-accordion-trigger{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;width:100%;padding:16px 0;border:0;background:transparent;color:var(--sh-foreground);font:inherit;text-align:left;cursor:pointer}
.sh-accordion-trigger:hover strong{text-decoration:underline;text-underline-offset:4px}
.sh-accordion-trigger>span{display:grid;gap:3px}
.sh-accordion-trigger strong{font-size:14px;font-weight:500}
.sh-accordion-trigger small{font-size:13px;color:var(--sh-muted-foreground)}
.sh-accordion-trigger .sh-chevron{margin-top:2px;transition:transform .2s}
.sh-accordion-item[data-state=open] .sh-chevron{transform:rotate(180deg)}
.sh-accordion-content{display:none;padding:0 0 16px}
.sh-accordion-item[data-state=open] .sh-accordion-content{display:block}
.sh-accordion-content ol{margin:0;padding:0 0 0 20px;display:grid;gap:8px;font-size:14px;line-height:1.5}
.sh-accordion-trigger:focus-visible{box-shadow:0 0 0 3px color-mix(in srgb,var(--sh-ring) 45%,transparent);border-radius:6px}

/* Tooltip */
.sh-tooltip{position:fixed;z-index:500;max-width:260px;padding:6px 12px;border-radius:6px;background:var(--sh-foreground);color:var(--sh-background);font-size:12px;line-height:1.3;pointer-events:none;animation:sh-in .12s ease-out}

/* Progress */
.tc-progress{height:8px!important;border-radius:999px!important;background:color-mix(in srgb,var(--sh-primary) 20%,transparent)!important}
.tc-progress i{border-radius:999px!important}

/* Kbd */
kbd{border-radius:4px;border:1px solid var(--sh-border);background:var(--sh-muted);box-shadow:none;font-weight:500}

/* Sonner */
.toast{border:1px solid var(--sh-border)!important;border-radius:10px!important;background:var(--sh-popover)!important;color:var(--sh-popover-foreground)!important;box-shadow:0 10px 30px rgba(0,0,0,.28)!important;font-size:14px!important}

/* ScrollArea: nessuna barra di scorrimento visibile in nessuna variante (lo scorrimento resta attivo) */
html,body,*{scrollbar-width:none!important;-ms-overflow-style:none!important}
html::-webkit-scrollbar,body::-webkit-scrollbar,*::-webkit-scrollbar{display:none!important;width:0!important;height:0!important;background:transparent!important}
*::-webkit-scrollbar-thumb,*::-webkit-scrollbar-track,*::-webkit-scrollbar-corner{display:none!important}

@media(prefers-reduced-motion:reduce){.sh-popover,.sh-tooltip{animation:none}.fs-switch,.fs-switch i,.sh-accordion-trigger .sh-chevron{transition:none}}
