/* ============================================================================
 * css/theme.css — AuraOMS v8 design system (production)
 *
 * Ported from ui-preview/styles.css (the design source of truth). TOUCH-FIRST,
 * modern B2B SaaS look; default palette = Indigo + Sky.
 *
 * ⚠️ SCOPED ON PURPOSE. Every rule is namespaced under `.aura` so this file is
 *    PURELY ADDITIVE: it has ZERO effect on the existing (Tailwind / Poppins)
 *    views — those are not inside a `.aura` container. The legacy app already
 *    uses bare `.btn` / `.input` / `.content` classes; scoping avoids clobbering
 *    them during the gradual v8 port.
 *
 * HOW TO USE (when porting a view): wrap the view's root element in
 *    <div class="aura" data-theme="indigo"> … </div>
 *    and use the same class names as the ui-preview mockups (.shell, .sidebar,
 *    .card, .btn, .input, .table, …). No further changes needed.
 *
 * House rules: Inter; radius 12px containers / 6px controls; flat hairline
 * borders, shadow only on hover/popovers; light sidebar; tint-only badges;
 * controls ≥48px, inputs ≥16px (no iOS focus-zoom), 16px base font.
 * ========================================================================== */

/* ---- Design tokens (defaults = Slate + Amber) -------------------------- */
.aura {
    --primary:        #0F172A;
    --surface:        #FFFFFF;
    --bg:             #F8FAFC;
    --border:         #E2E8F0;
    --border-strong:  #CBD5E1;
    --muted:          #64748B;
    --muted-soft:     #94A3B8;
    --nav-text:       #475569;
    --accent:         #D97706;
    --accent-hover:   #B45309;
    --accent-soft:    #FEF3C7;
    --accent-ring:    rgba(217, 119, 6, .18);

    --success: #059669;  --success-soft: #ECFDF5; --success-text: #047857;
    --warning: #D97706;  --warning-soft: #FFFBEB; --warning-text: #B45309;
    --info:    #2563EB;  --info-soft:    #EFF6FF; --info-text:    #1D4ED8;
    --danger:  #DC2626;  --danger-soft:  #FEF2F2; --danger-text:  #B91C1C;
    --neutral: #64748B;  --neutral-soft: #F1F5F9; --neutral-text: #475569;
    --indigo:  #4F46E5;  --indigo-soft:  #EEF2FF; --indigo-text:  #4338CA;

    --radius:    6px;
    --radius-lg: 12px;
    --shadow-hover: 0 6px 22px rgba(15, 23, 42, .07);
    --shadow-pop:   0 16px 44px rgba(15, 23, 42, .14);
    --sidebar-w: 240px;

    --control-h:    48px;
    --control-h-sm: 40px;
    --tap-min:      44px;

    /* Base typography / surface for the scoped subtree */
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--primary);
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: "cv02", "cv03", "cv04", "cv11";
}

/* Palette B — Indigo + Sky (the chosen default; set data-theme on the .aura root) */
.aura[data-theme="indigo"] {
    --primary:        #1E293B;
    --bg:             #F8FAFC;
    --accent:         #4F46E5;
    --accent-hover:   #4338CA;
    --accent-soft:    #EEF2FF;
    --accent-ring:    rgba(79, 70, 229, .16);

    --success: #10B981;  --success-soft: #ECFDF5; --success-text: #047857;
    --warning: #F59E0B;  --warning-soft: #FFFBEB; --warning-text: #B45309;
    --info:    #0EA5E9;  --info-soft:    #F0F9FF; --info-text:    #0369A1;
    --danger:  #EF4444;  --danger-soft:  #FEF2F2; --danger-text:  #B91C1C;
    --neutral: #64748B;  --neutral-soft: #F1F5F9; --neutral-text: #475569;
}

.aura *, .aura *::before, .aura *::after { box-sizing: border-box; }

/* Ensure Tailwind's .hidden still wins inside .aura even on themed components
   (e.g. a `.btn` toggled via classList hidden ↔ shown). Component rules like
   `.aura .btn { display:inline-flex }` would otherwise out-specify `.hidden`. */
.aura .hidden { display: none !important; }

.aura .eyebrow {
    font-size: 11px; font-weight: 600; letter-spacing: .06em;
    text-transform: uppercase; color: var(--muted);
}

/* ---- App shell ---------------------------------------------------------- */
.aura .shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }

.aura .sidebar {
    background: var(--surface); color: var(--primary);
    border-right: 1px solid var(--border);
    padding: 18px 14px; display: flex; flex-direction: column; gap: 2px;
    position: sticky; top: 0; height: 100vh;
}
.aura .brand { display: flex; align-items: center; gap: 12px; padding: 8px 8px 22px; }
.aura .brand-mark {
    width: 44px; height: 44px; border-radius: 11px; background: var(--accent);
    display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 19px; letter-spacing: -.02em;
}
.aura .brand-name { font-weight: 700; font-size: 17.5px; letter-spacing: -.01em; color: var(--primary); }
.aura .brand-sub  { font-size: 11px; color: var(--muted); letter-spacing: .07em; text-transform: uppercase; margin-top: 2px; }

.aura .nav-item {
    display: flex; align-items: center; gap: 11px; min-height: var(--control-h); padding: 8px 12px; border-radius: var(--radius);
    color: var(--nav-text); font-size: 15px; font-weight: 500; cursor: pointer; text-decoration: none;
    transition: background .12s, color .12s;
}
.aura .nav-item:hover { background: var(--bg); color: var(--primary); }
.aura .nav-item.active { background: var(--accent-soft); color: var(--accent-hover); font-weight: 600; }
.aura .nav-item .ico { width: 17px; text-align: center; opacity: .85; font-size: 13px; }
.aura .nav-group { margin-top: 16px; padding: 0 12px 6px; }
.aura .sidebar-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--border); font-size: 11px; color: var(--muted-soft); }

.aura .main { display: flex; flex-direction: column; min-width: 0; }
.aura .topbar {
    height: 60px; background: var(--surface); border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between; padding: 0 26px; position: sticky; top: 0; z-index: 20;
}
.aura .topbar h1 { font-size: 17px; font-weight: 700; margin: 0; letter-spacing: -.01em; }
.aura .topbar .sub { font-size: 12px; color: var(--muted); font-weight: 400; margin-top: 1px; }
.aura .content { padding: 24px 26px; }

.aura .user-chip { display: flex; align-items: center; gap: 10px; }
.aura .avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-hover);
    display: grid; place-items: center; font-weight: 700; font-size: 12.5px; }

/* ---- Buttons (flat, 6px) ------------------------------------------------ */
.aura .btn {
    display: inline-flex; align-items: center; gap: 7px; justify-content: center;
    font-family: inherit; font-weight: 600; font-size: 15px; letter-spacing: -.005em;
    min-height: var(--control-h); padding: 0 18px; border-radius: var(--radius); border: 1px solid transparent; cursor: pointer;
    transition: background .12s, border-color .12s, color .12s; text-decoration: none; white-space: nowrap;
}
.aura .btn:active { transform: translateY(.5px); }
.aura .btn-primary   { background: var(--accent); color: #fff; }
.aura .btn-primary:hover { background: var(--accent-hover); }
.aura .btn-secondary { background: var(--surface); color: var(--primary); border-color: var(--border-strong); }
.aura .btn-secondary:hover { background: var(--bg); border-color: var(--muted-soft); }
.aura .btn-ghost     { background: transparent; color: var(--muted); }
.aura .btn-ghost:hover { background: var(--bg); color: var(--primary); }
.aura .btn-danger    { background: var(--danger); color: #fff; }
.aura .btn-success   { background: var(--success); color: #fff; }
.aura .btn-sm { min-height: var(--control-h-sm); padding: 0 14px; font-size: 14px; }
.aura .btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---- Photo modal (global #photoModal) — dropzone + gallery cards ----------- */
.aura .photo-dz { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 2px; border: 2px dashed var(--border-strong); border-radius: var(--radius-lg); background: var(--bg);
    padding: 26px; text-align: center; cursor: pointer; transition: border-color .12s, background .12s; }
.aura .photo-dz:hover, .aura .photo-dz.dragging { border-color: var(--accent); background: var(--accent-soft); }
.aura .photo-card { position: relative; border: 1px solid var(--border); border-radius: 10px; overflow: hidden;
    background: var(--surface); display: flex; flex-direction: column; }
.aura .photo-card .pc-img { position: relative; aspect-ratio: 1; background: var(--bg); overflow: hidden; display: grid; place-items: center; }
.aura .photo-card .pc-img img { width: 100%; height: 100%; object-fit: cover; }
.aura .photo-card .pc-ov { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
    gap: 10px; background: rgba(15,23,42,.55); opacity: 0; transition: opacity .12s; }
.aura .photo-card:hover .pc-ov { opacity: 1; }
.aura .photo-card .pc-btn { width: 36px; height: 36px; border: 0; border-radius: 9px; cursor: pointer; display: grid;
    place-items: center; font-size: 15px; background: var(--surface); color: var(--primary); }
.aura .photo-card .pc-btn.danger { background: var(--danger); color: #fff; }
.aura .photo-card .pc-tick { position: absolute; top: 6px; right: 6px; width: 20px; height: 20px; border-radius: 50%;
    background: var(--success); color: #fff; display: grid; place-items: center; }
.aura .photo-note { width: 100%; border: 0; border-top: 1px solid var(--border); background: var(--surface);
    padding: 8px 10px; font-size: 12px; color: var(--primary); outline: none; }
.aura .photo-note:focus { background: var(--bg); }
.aura .photo-note:disabled { opacity: .5; }

/* ---- Cards (flat: border, no resting shadow) --------------------------- */
.aura .card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 20px;
}
.aura .card-pad-0 { padding: 0; overflow: hidden; }
.aura .card-title { font-size: 14.5px; font-weight: 700; margin: 0; letter-spacing: -.01em; }
.aura .card-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 16px; }
.aura .card-head p { margin: 3px 0 0; font-size: 12px; color: var(--muted); }
.aura .divider { height: 1px; background: var(--border); border: 0; margin: 0; }

/* ---- Stats ------------------------------------------------------------- */
.aura .stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.aura .stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px; }
.aura .stat .stat-label { font-size: 11px; color: var(--muted); font-weight: 500; text-transform: uppercase; letter-spacing: .06em; }
.aura .stat .stat-value { font-size: 27px; font-weight: 700; margin-top: 7px; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.aura .stat .stat-trend { font-size: 12px; font-weight: 500; margin-top: 5px; }
.aura .trend-up { color: var(--success); } .aura .trend-down { color: var(--danger); }

/* ---- Badges (tint bg + text only, no border/dot) ----------------------- */
.aura .badge {
    display: inline-flex; align-items: center; font-size: 12px; font-weight: 600;
    padding: 4px 9px; border-radius: var(--radius); letter-spacing: -.005em;
    background: var(--neutral-soft); color: var(--neutral-text);
}
.aura .b-quote     { background: var(--neutral-soft); color: var(--neutral-text); }
.aura .b-confirmed { background: var(--info-soft);    color: var(--info-text); }
.aura .b-arrived   { background: var(--info-soft);    color: var(--info-text); }
.aura .b-prepared  { background: var(--warning-soft); color: var(--warning-text); }
.aura .b-installed { background: var(--indigo-soft);  color: var(--indigo-text); }
.aura .b-completed { background: var(--success-soft); color: var(--success-text); }

/* ---- Inputs ------------------------------------------------------------ */
.aura .field { display: flex; flex-direction: column; gap: 6px; }
.aura .label { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.aura .input {
    width: 100%; font-family: inherit; font-size: 16px; font-weight: 400; color: var(--primary);
    background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); min-height: var(--control-h); padding: 10px 14px;
    outline: none; transition: border-color .12s, box-shadow .12s;
}
.aura .input::placeholder { color: var(--muted-soft); }
.aura .input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }

/* ---- Table ------------------------------------------------------------- */
.aura .table { width: 100%; border-collapse: collapse; font-size: 14px; }
.aura .table thead th {
    text-align: left; font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase;
    letter-spacing: .05em; padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--bg);
}
.aura .table tbody td { padding: 14px 16px; border-bottom: 1px solid var(--border); font-weight: 400; vertical-align: middle; }
.aura .table tbody tr:last-child td { border-bottom: 0; }
.aura .table tbody tr:hover { background: var(--bg); }
.aura .t-strong { font-weight: 600; color: var(--primary); }
.aura .t-mono { font-variant-numeric: tabular-nums; }

/* ---- Kanban ------------------------------------------------------------ */
.aura .kanban { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; align-items: start; }
.aura .kcol { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 12px; }
.aura .kcol-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px 12px; }
.aura .kcol-head .ktitle { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.aura .kcount { font-size: 11px; font-weight: 600; color: var(--muted); background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius); padding: 1px 8px; font-variant-numeric: tabular-nums; }
.aura .kcard { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 14px;
    margin-bottom: 10px; cursor: pointer; transition: box-shadow .12s, border-color .12s; }
.aura .kcard:active { border-color: var(--border-strong); }
.aura .kcard:hover { box-shadow: var(--shadow-hover); border-color: var(--border-strong); }
.aura .kcard .k-cust { font-weight: 600; font-size: 15px; letter-spacing: -.01em; }
.aura .kcard .k-meta { font-size: 13px; color: var(--muted); margin-top: 2px; }
.aura .kcard .k-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; }

/* ---- Focus & touch feedback (no :hover on touch screens) --------------- */
.aura .btn:focus-visible, .aura .nav-item:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.aura .nav-item:active, .aura .table tbody tr:active { background: var(--bg); }

/* ---- Misc -------------------------------------------------------------- */
.aura .row { display: flex; align-items: center; gap: 12px; }
.aura .between { display: flex; align-items: center; justify-content: space-between; }
.aura .muted { color: var(--muted); }
.aura .grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.aura .section-title { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 12px; }
.aura .swatch { height: 52px; border-radius: 8px; border: 1px solid var(--border); }

/* ---- Spec rows: factory cut-sizes / fitter run-sheets --------------------
   Shared by the production (#manufacturingSpecsContainer) and installation
   (#installationSpecsContainer) modals. Dense, info-first rows: an item block
   on the left, a horizontally-scrollable strip of labelled metrics + a tick
   on the right. Renderers keep the data-change-action checkbox hooks. */
.aura .spec-group { margin-bottom: 22px; }
.aura .spec-group:last-child { margin-bottom: 0; }
.aura .spec-group-title { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700;
    text-transform: uppercase; letter-spacing: .05em; color: var(--muted); border-bottom: 1px solid var(--border);
    padding-bottom: 8px; margin-bottom: 10px; }
.aura .spec-table { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.aura .spec-row { display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 10px 14px; border-bottom: 1px solid var(--border); }
.aura .spec-row:last-child { border-bottom: 0; }
.aura .spec-item { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.aura .spec-id { font-size: 13px; font-weight: 700; color: var(--muted-soft); flex: none; font-variant-numeric: tabular-nums; }
.aura .spec-main { min-width: 0; }
.aura .spec-loc { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.aura .spec-loc .nm { font-weight: 700; font-size: 15px; color: var(--primary);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px; }
.aura .spec-loc .dim { font-size: 12.5px; font-weight: 600; color: var(--accent-hover); white-space: nowrap; font-variant-numeric: tabular-nums; }
.aura .spec-sub { font-size: 11.5px; color: var(--muted); margin-top: 3px; text-transform: uppercase; letter-spacing: .02em;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aura .spec-metrics { display: flex; align-items: center; flex: none; overflow-x: auto; scrollbar-width: none; }
.aura .spec-metrics::-webkit-scrollbar { display: none; }
.aura .spec-metric { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 0 14px; flex: none;
    border-left: 1px solid var(--border); }
.aura .spec-metric:first-child { border-left: 0; }
.aura .spec-metric .mk { font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted-soft); }
.aura .spec-metric .mv { font-size: 14px; font-weight: 600; color: var(--primary); white-space: nowrap; font-variant-numeric: tabular-nums; }
.aura .spec-metric.cut .mv { font-size: 18px; font-weight: 700; color: var(--accent-hover); }
.aura .spec-metric .mu { font-size: 10px; color: var(--muted-soft); margin-left: 1px; }
.aura .spec-tag { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .02em; padding: 1px 6px; border-radius: 4px; }
.aura .spec-tag.motor { background: var(--accent-soft); color: var(--accent-hover); }
.aura .spec-tag.manual { background: var(--neutral-soft); color: var(--neutral-text); }
.aura .spec-check { width: 26px; height: 26px; accent-color: var(--success); cursor: pointer; flex: none; margin-left: 10px; }
.aura .spec-empty { text-align: center; padding: 40px; color: var(--muted-soft); font-size: 13px; }
