/* =========================================================
   EMPIRE - Shop Management Portal
   Theme: light, green accent, card + table layout
   ========================================================= */

:root {
    --green:        #12a150;
    --green-dark:   #0d8a43;
    --green-soft:   #e9f7ef;
    --green-softer: #f3fbf6;

    --amber:      #d97706;
    --amber-soft: #fef3e2;
    --red:        #dc2626;
    --red-soft:   #fee2e2;
    --blue:       #2563eb;
    --blue-soft:  #e0edff;

    --ink:     #1b2430;
    --ink-2:   #46525f;
    --muted:   #7a8792;
    --line:    #e6eae8;
    --line-2:  #f0f3f1;
    --bg:      #f5f7f6;
    --white:   #ffffff;

    --radius:    12px;
    --radius-sm: 8px;
    --shadow:    0 1px 2px rgba(16, 24, 40, .04);
    --shadow-md: 0 8px 24px rgba(16, 24, 40, .10);
    --sidebar-w: 236px;
    --topbar-h:  66px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
}

body {
    background: var(--bg);
    color: var(--ink);
    font: 14px/1.5 "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
svg { flex-shrink: 0; }

/* ---------------------------------------------------------
   App shell
   --------------------------------------------------------- */
.app { min-height: 100vh; }

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-w);
    background: var(--white);
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    z-index: 40;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    height: var(--topbar-h);
    padding: 0 18px;
    border-bottom: 1px solid var(--line-2);
}
.brand-mark {
    width: 32px; height: 32px;
    border-radius: 9px;
    background: var(--green);
    color: #fff;
    display: grid; place-items: center;
    font-weight: 700; font-size: 14px;
    letter-spacing: .5px;
}
.brand-name { font-size: 16px; font-weight: 700; color: var(--green); }
.brand-sub  { font-size: 10.5px; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; }

.nav {
    flex: 1;
    overflow-y: auto;
    padding: 12px 12px 20px;
}
.nav-label {
    font-size: 10.5px; font-weight: 700; letter-spacing: .08em;
    text-transform: uppercase; color: #9aa5ad;
    padding: 14px 10px 6px;
}
.nav-item {
    display: flex; align-items: center; gap: 11px;
    padding: 9px 12px;
    border-radius: 9px;
    color: var(--ink-2);
    font-size: 13.5px; font-weight: 500;
    margin-bottom: 2px;
    transition: background .15s, color .15s;
}
.nav-item svg { width: 18px; height: 18px; stroke-width: 1.7; }
.nav-item:hover { background: var(--line-2); color: var(--ink); }
.nav-item.active {
    background: var(--green-soft);
    color: var(--green-dark);
    font-weight: 600;
}
.nav-item.active svg { color: var(--green); }
.nav-badge {
    margin-left: auto;
    background: var(--red); color: #fff;
    font-size: 10px; font-weight: 700;
    padding: 1px 6px; border-radius: 20px;
}

.sidebar-foot {
    border-top: 1px solid var(--line-2);
    padding: 12px 18px;
    font-size: 11.5px; color: var(--muted);
}
.dot-live {
    display: inline-flex; align-items: center; gap: 6px;
    color: var(--green-dark); font-weight: 600;
}
.dot-live::before {
    content: ""; width: 7px; height: 7px; border-radius: 50%;
    background: var(--green);
}

/* ---------------------------------------------------------
   Top bar
   --------------------------------------------------------- */
.main {
    margin-left: var(--sidebar-w);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar {
    position: sticky; top: 0;
    height: var(--topbar-h);
    background: var(--white);
    border-bottom: 1px solid var(--line);
    display: flex; align-items: center; gap: 14px;
    padding: 0 22px;
    z-index: 30;
}

.icon-btn {
    width: 38px; height: 38px;
    display: grid; place-items: center;
    border: 1px solid var(--line);
    background: var(--white);
    border-radius: 10px;
    color: var(--ink-2);
    cursor: pointer;
}
.icon-btn:hover { background: var(--line-2); }
.icon-btn.bare { border-color: transparent; }

.search {
    position: relative;
    flex: 1;
    max-width: 430px;
}
.search svg {
    position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
    width: 17px; height: 17px; color: var(--muted);
}
.search input {
    width: 100%;
    height: 40px;
    padding: 0 60px 0 40px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fbfcfc;
    font-size: 13.5px;
    color: var(--ink);
    outline: none;
}
.search input:focus { border-color: var(--green); background: #fff; box-shadow: 0 0 0 3px var(--green-soft); }
.kbd {
    position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
    font-size: 10.5px; color: var(--muted);
    border: 1px solid var(--line); border-radius: 5px;
    padding: 2px 5px; background: #fff;
}

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.bell { position: relative; }
.bell .count {
    position: absolute; top: -4px; right: -4px;
    background: var(--red); color: #fff;
    font-size: 10px; font-weight: 700;
    min-width: 17px; height: 17px; border-radius: 9px;
    display: grid; place-items: center; padding: 0 4px;
}

.user-chip {
    display: flex; align-items: center; gap: 9px;
    padding: 5px 10px 5px 5px;
    border: 1px solid var(--line);
    border-radius: 30px;
    background: var(--white);
    cursor: pointer;
}
.user-chip:hover { background: var(--line-2); }
.avatar {
    width: 30px; height: 30px; border-radius: 50%;
    background: var(--green-soft); color: var(--green-dark);
    display: grid; place-items: center;
    font-size: 12px; font-weight: 700;
}
.user-meta { line-height: 1.15; text-align: left; }
.user-meta b { font-size: 13px; font-weight: 600; display: block; }
.user-meta span { font-size: 11px; color: var(--muted); }

.dropdown { position: relative; }
.dropdown-menu {
    position: absolute; right: 0; top: calc(100% + 8px);
    min-width: 190px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
    box-shadow: var(--shadow-md);
    padding: 6px;
    display: none;
    z-index: 60;
}
.dropdown.open .dropdown-menu { display: block; }
.dropdown-menu a, .dropdown-menu button {
    display: flex; align-items: center; gap: 9px;
    width: 100%; text-align: left;
    padding: 8px 10px; border: 0; background: none;
    border-radius: 7px; font-size: 13px; color: var(--ink-2);
    cursor: pointer; font-family: inherit;
}
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--line-2); color: var(--ink); }
.dropdown-menu .sep { height: 1px; background: var(--line-2); margin: 5px 2px; }
.dropdown-menu .danger { color: var(--red); }

.chip-outline {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 7px 11px;
    font-size: 12.5px; font-weight: 600; color: var(--ink-2);
    background: #fff;
}

/* ---------------------------------------------------------
   Page
   --------------------------------------------------------- */
.page {
    padding: 24px 26px 40px;
    flex: 1;
}

.page-head {
    display: flex; align-items: flex-start; gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}
.page-title { font-size: 24px; font-weight: 700; }
.page-sub   { color: var(--muted); font-size: 13.5px; margin-top: 3px; }
.page-actions { margin-left: auto; display: flex; gap: 10px; flex-wrap: wrap; }

.breadcrumb { font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.breadcrumb a:hover { color: var(--green-dark); }

/* ---------------------------------------------------------
   Buttons
   --------------------------------------------------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 40px; padding: 0 16px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: var(--white);
    color: var(--ink-2);
    font: 600 13.5px/1 inherit;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
    transition: background .15s, border-color .15s, box-shadow .15s;
}
.btn svg { width: 17px; height: 17px; }
.btn:hover { background: var(--line-2); }
.btn-primary {
    background: var(--green); border-color: var(--green); color: #fff;
    box-shadow: 0 1px 2px rgba(18, 161, 80, .3);
}
.btn-primary:hover { background: var(--green-dark); border-color: var(--green-dark); }
.btn-danger { color: var(--red); }
.btn-danger:hover { background: var(--red-soft); border-color: #fca5a5; }
.btn-sm { height: 34px; padding: 0 12px; font-size: 12.5px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* ---------------------------------------------------------
   KPI tiles
   --------------------------------------------------------- */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 16px;
    margin-bottom: 22px;
}
.kpi {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 17px 18px;
    display: flex; align-items: flex-start; gap: 12px;
    box-shadow: var(--shadow);
}
.kpi-body { flex: 1; min-width: 0; }
.kpi-label { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.kpi-value { font-size: 25px; font-weight: 700; margin: 6px 0 3px; letter-spacing: -.02em; }
.kpi-foot  { font-size: 11.5px; color: var(--muted); }
.kpi-icon {
    width: 42px; height: 42px; border-radius: 12px;
    display: grid; place-items: center;
    background: var(--green-soft); color: var(--green);
}
.kpi-icon svg { width: 21px; height: 21px; }
.kpi-icon.amber { background: var(--amber-soft); color: var(--amber); }
.kpi-icon.red   { background: var(--red-soft);   color: var(--red); }
.kpi-icon.blue  { background: var(--blue-soft);  color: var(--blue); }

/* a KPI tile that filters the list when clicked */
a.kpi { text-decoration: none; transition: border-color .15s, box-shadow .15s, transform .12s; }
a.kpi:hover { border-color: #cfe7da; box-shadow: 0 4px 14px rgba(16,24,40,.07); transform: translateY(-1px); }

/* ---------------------------------------------------------
   Card
   --------------------------------------------------------- */
.card {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 18px;
}
.card-head {
    display: flex; align-items: center; gap: 12px;
    padding: 15px 18px;
    border-bottom: 1px solid var(--line-2);
    flex-wrap: wrap;
}
.card-title { font-size: 15px; font-weight: 600; }
.card-sub   { font-size: 12px; color: var(--muted); margin-top: 2px; }
.card-head .spacer { margin-left: auto; }
.card-body { padding: 18px; }
.card-foot {
    padding: 13px 18px;
    border-top: 1px solid var(--line-2);
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}

/* Tabs */
.tabs {
    display: flex; align-items: center; gap: 4px;
    border-bottom: 1px solid var(--line);
    padding: 0 18px;
    overflow-x: auto;
}
.tab {
    padding: 13px 14px;
    font-size: 13.5px; font-weight: 500; color: var(--muted);
    border-bottom: 2px solid transparent;
    white-space: nowrap;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--green-dark); font-weight: 600; border-bottom-color: var(--green); }
.tab .n { color: #9aa5ad; font-weight: 500; }

/* Toolbar inside a card */
.toolbar {
    display: flex; align-items: center; gap: 10px;
    padding: 14px 18px;
    flex-wrap: wrap;
}
.toolbar .spacer { margin-left: auto; }
.toolbar .search { max-width: 300px; flex: none; width: 300px; }
.toolbar .search input { height: 38px; padding-right: 14px; }

/* ---------------------------------------------------------
   Tables
   --------------------------------------------------------- */
.table-wrap { overflow-x: auto; }
table.tbl {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.2px;
}
table.tbl thead th {
    background: #fafbfa;
    border-top: 1px solid var(--line-2);
    border-bottom: 1px solid var(--line);
    padding: 11px 14px;
    text-align: left;
    font-size: 11.5px; font-weight: 700; letter-spacing: .03em;
    text-transform: uppercase; color: #78858f;
    white-space: nowrap;
}
table.tbl tbody td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--line-2);
    color: var(--ink-2);
    vertical-align: middle;
}
table.tbl tbody tr:hover { background: #fafcfb; }
table.tbl tbody tr:last-child td { border-bottom: 0; }
table.tbl .num  { text-align: right; font-variant-numeric: tabular-nums; }
table.tbl .mid  { text-align: center; }
table.tbl .code { font-weight: 600; color: var(--ink); font-family: "Consolas", ui-monospace, monospace; font-size: 12.5px; }
table.tbl .name { font-weight: 600; color: var(--ink); }
table.tbl .sub  { font-size: 11.5px; color: var(--muted); font-weight: 400; }
.stock-low  { color: var(--amber); font-weight: 700; }
.stock-out  { color: var(--red);   font-weight: 700; }
.stock-ok   { color: var(--ink);   font-weight: 600; }

.row-actions { display: flex; gap: 4px; justify-content: flex-end; }
.act {
    width: 30px; height: 30px; border-radius: 7px;
    display: grid; place-items: center;
    border: 1px solid transparent; background: none;
    color: var(--muted); cursor: pointer;
}
.act svg { width: 16px; height: 16px; }
.act:hover { background: var(--line-2); color: var(--green-dark); border-color: var(--line); }
.act.danger:hover { background: var(--red-soft); color: var(--red); border-color: #fca5a5; }

/* Badges */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11.5px; font-weight: 600;
    white-space: nowrap;
}
.badge-green { background: var(--green-soft); color: var(--green-dark); }
.badge-amber { background: var(--amber-soft); color: var(--amber); }
.badge-red   { background: var(--red-soft);   color: var(--red); }
.badge-blue  { background: var(--blue-soft);  color: var(--blue); }
.badge-gray  { background: #eef1f0;           color: #667180; }

/* Pagination */
.pagination {
    display: flex; align-items: center; gap: 5px;
    margin-left: auto;
}
.pagination a, .pagination span {
    min-width: 32px; height: 32px;
    padding: 0 8px;
    border: 1px solid var(--line);
    border-radius: 8px;
    display: grid; place-items: center;
    font-size: 13px; color: var(--ink-2);
    background: #fff;
}
.pagination a:hover { background: var(--line-2); }
.pagination .current { background: var(--green); border-color: var(--green); color: #fff; font-weight: 600; }
.pagination .disabled { opacity: .45; pointer-events: none; }
.pagination .gap { border: 0; background: none; }

.result-count { font-size: 12.5px; color: var(--muted); }

/* Empty state */
.empty {
    padding: 54px 20px;
    text-align: center;
    color: var(--muted);
}
.empty svg { width: 42px; height: 42px; color: #c8d1cc; margin-bottom: 12px; }
.empty h4 { font-size: 15px; color: var(--ink); margin-bottom: 5px; }
.empty p  { margin: 0 0 16px; font-size: 13px; }

/* ---------------------------------------------------------
   Forms
   --------------------------------------------------------- */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 16px 18px;
}
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field.col-2 { grid-column: span 2; }
.field.col-full { grid-column: 1 / -1; }
label.lbl {
    font-size: 12.5px; font-weight: 600; color: var(--ink-2);
}
label.lbl .req { color: var(--red); }
.hint { font-size: 11.5px; color: var(--muted); }

.input, select.input, textarea.input {
    width: 100%;
    height: 40px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: #fff;
    font: inherit;
    font-size: 13.5px;
    color: var(--ink);
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}
textarea.input { height: auto; padding: 10px 12px; resize: vertical; min-height: 84px; }
select.input {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%237a8792' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 11px center;
    padding-right: 32px;
}
.input:focus, select.input:focus, textarea.input:focus {
    border-color: var(--green);
    box-shadow: 0 0 0 3px var(--green-soft);
}
.input:disabled, .input[readonly] { background: #f6f8f7; color: var(--ink-2); }
.input.is-error { border-color: #fca5a5; box-shadow: 0 0 0 3px var(--red-soft); }
.err-text { font-size: 11.5px; color: var(--red); }

.input-group { display: flex; gap: 8px; }
.input-group .input { flex: 1; }

.switch { display: flex; align-items: center; gap: 9px; font-size: 13.5px; color: var(--ink-2); cursor: pointer; }
.switch input { display: none; }
.switch .track {
    width: 38px; height: 22px; border-radius: 20px;
    background: #d8dedb; position: relative; transition: background .18s;
}
.switch .track::after {
    content: ""; position: absolute; top: 3px; left: 3px;
    width: 16px; height: 16px; border-radius: 50%;
    background: #fff; transition: transform .18s;
    box-shadow: 0 1px 2px rgba(0,0,0,.2);
}
.switch input:checked + .track { background: var(--green); }
.switch input:checked + .track::after { transform: translateX(16px); }

.form-actions {
    display: flex; gap: 10px; align-items: center;
    flex-wrap: wrap;
}
.form-actions .spacer { margin-left: auto; }

fieldset.section {
    border: 0; padding: 0; margin: 0 0 26px;
}
fieldset.section > legend {
    font-size: 13px; font-weight: 700; color: var(--ink);
    padding: 0 0 12px;
    text-transform: uppercase; letter-spacing: .04em;
}
.section-note { font-size: 12px; color: var(--muted); font-weight: 400; text-transform: none; letter-spacing: 0; }

/* ---------------------------------------------------------
   Alerts
   --------------------------------------------------------- */
.alert {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 13.2px;
    margin-bottom: 16px;
    border: 1px solid transparent;
}
.alert svg { width: 18px; height: 18px; margin-top: 1px; }
.alert-success { background: var(--green-soft); color: #11663a; border-color: #b9e6cd; }
.alert-error   { background: var(--red-soft);   color: #991b1b; border-color: #fbbdbd; }
.alert-warning { background: var(--amber-soft); color: #92400e; border-color: #fbd9a5; }
.alert-info    { background: var(--blue-soft);  color: #1e40af; border-color: #bfd7fe; }
.alert .close { margin-left: auto; cursor: pointer; opacity: .6; background: none; border: 0; font-size: 17px; line-height: 1; color: inherit; }

/* ---------------------------------------------------------
   Modal
   --------------------------------------------------------- */
.modal-backdrop {
    position: fixed; inset: 0;
    background: rgba(16, 24, 40, .45);
    display: none;
    align-items: flex-start; justify-content: center;
    padding: 60px 16px;
    z-index: 80;
    overflow-y: auto;
}
.modal-backdrop.open { display: flex; }
.modal {
    background: #fff;
    border-radius: 14px;
    width: 100%;
    max-width: 560px;
    box-shadow: var(--shadow-md);
    overflow: hidden;
}
.modal-head {
    display: flex; align-items: center;
    padding: 16px 18px;
    border-bottom: 1px solid var(--line-2);
}
.modal-head h3 { font-size: 16px; }
.modal-head .close {
    margin-left: auto; background: none; border: 0;
    font-size: 21px; line-height: 1; color: var(--muted); cursor: pointer;
}
.modal-body { padding: 18px; }
.modal-foot {
    padding: 14px 18px;
    border-top: 1px solid var(--line-2);
    display: flex; gap: 10px; justify-content: flex-end;
    background: #fafbfa;
}

/* ---------------------------------------------------------
   Login
   --------------------------------------------------------- */
.login-wrap {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr 1fr;
}
.login-art {
    background: linear-gradient(150deg, #0f8f47 0%, #12a150 45%, #0b7a3c 100%);
    color: #fff;
    padding: 56px;
    display: flex; flex-direction: column; justify-content: center;
    position: relative; overflow: hidden;
}
.login-art::after {
    content: ""; position: absolute;
    width: 460px; height: 460px; border-radius: 50%;
    background: rgba(255,255,255,.07);
    right: -140px; bottom: -160px;
}
.login-art h1 { font-size: 34px; line-height: 1.2; margin-bottom: 14px; }
.login-art p  { font-size: 15px; opacity: .9; max-width: 380px; line-height: 1.65; }
.login-art .feats { margin-top: 34px; display: grid; gap: 13px; }
.login-art .feat { display: flex; align-items: center; gap: 11px; font-size: 14px; }
.login-art .feat span {
    width: 26px; height: 26px; border-radius: 8px;
    background: rgba(255,255,255,.18);
    display: grid; place-items: center;
}
.login-panel {
    display: grid; place-items: center;
    padding: 40px 24px;
    background: var(--white);
}
.login-box { width: 100%; max-width: 380px; }
.login-box .brand { border: 0; padding: 0; height: auto; margin-bottom: 28px; }
.login-box h2 { font-size: 22px; margin-bottom: 6px; }
.login-box .muted { color: var(--muted); font-size: 13.5px; margin-bottom: 26px; }
.login-box .field { margin-bottom: 15px; }
.demo-note {
    margin-top: 22px; padding: 12px 14px;
    background: var(--green-softer); border: 1px dashed #bfe6cf;
    border-radius: 10px; font-size: 12.3px; color: #2c6b48;
}
.demo-note b { color: #11663a; }

/* ---------------------------------------------------------
   Misc
   --------------------------------------------------------- */
.muted   { color: var(--muted); }
.strong  { font-weight: 600; color: var(--ink); }
.nowrap  { white-space: nowrap; }
.mt-0 { margin-top: 0; } .mb-0 { margin-bottom: 0; }
.mt-16 { margin-top: 16px; } .mb-16 { margin-bottom: 16px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; }

.list-row {
    display: flex; align-items: center; gap: 12px;
    padding: 11px 0;
    border-bottom: 1px solid var(--line-2);
    font-size: 13.2px;
}
.list-row:last-child { border-bottom: 0; }
.list-row .spacer { margin-left: auto; }

.bar { height: 7px; border-radius: 6px; background: var(--line-2); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--green); border-radius: 6px; }
.bar > i.amber { background: var(--amber); }
.bar > i.red   { background: var(--red); }

.pill-link {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 12.5px; font-weight: 600; color: var(--green-dark);
}
.pill-link:hover { text-decoration: underline; }

.denied {
    max-width: 440px; margin: 70px auto; text-align: center;
    background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
    padding: 40px 30px;
}
.denied .ic {
    width: 54px; height: 54px; border-radius: 16px; margin: 0 auto 16px;
    background: var(--red-soft); color: var(--red);
    display: grid; place-items: center;
}

/* ---------------------------------------------------------
   Collapsed sidebar ("rail")
   --------------------------------------------------------- */
.sidebar, .main { transition: width .18s ease, margin-left .18s ease; }

@media (min-width: 993px) {
    body.rail .sidebar { width: 64px; }
    body.rail .main    { margin-left: 64px; }

    body.rail .sidebar .brand       { justify-content: center; padding: 0; }
    body.rail .sidebar .brand > span:last-child,
    body.rail .nav-item > span,
    body.rail .nav-label,
    body.rail .sidebar-foot > *:not(.dot-live) { display: none; }

    body.rail .nav                  { padding: 12px 8px; }
    body.rail .nav-item             { justify-content: center; padding: 10px; position: relative; }
    body.rail .nav-item .nav-badge  {
        position: absolute; top: 4px; right: 4px;
        min-width: 7px; height: 7px; padding: 0;
        font-size: 0; border-radius: 50%;
    }
    body.rail .sidebar-foot         { text-align: center; padding: 12px 6px; font-size: 0; }
    body.rail .sidebar-foot .dot-live::before { margin: 0; }
}

/* ---------------------------------------------------------
   Stock sheet (Excel style)
   --------------------------------------------------------- */
.sheet-card .tabs.sheet-tabs { background: #fff; border-radius: var(--radius) var(--radius) 0 0; }

table.sheet tbody td { padding: 9px 14px; }

table.sheet tr.grp td {
    background: #e2701f;
    color: #fff;
    font-weight: 700;
    font-size: 12.5px;
    letter-spacing: .03em;
    text-transform: uppercase;
    border-bottom: 1px solid #c85f16;
    padding: 9px 14px;
}
table.sheet tr.grp:hover td { background: #e2701f; }
table.sheet tr.grp td.code, table.sheet tr.grp td.num { color: #fff; font-family: inherit; }

table.sheet tr.zero td      { background: #e7ebe8; color: #5d6a73; }
table.sheet tr.zero:hover td { background: #e1e6e2; }
table.sheet tr.zero td.mid  { color: #5d6a73; }

table.sheet td.code a:hover { color: var(--green-dark); text-decoration: underline; }

.stock-btns { display: flex; gap: 6px; justify-content: center; }
.stock-btns .btn { gap: 5px; padding: 0 9px; }

.btn-in  svg { color: var(--green); }
.btn-out svg { color: var(--amber); }
.btn-in:hover:not([disabled])  { background: var(--green-soft); border-color: #b9e6cd; color: var(--green-dark); }
.btn-out:hover:not([disabled]) { background: var(--amber-soft); border-color: #fbd9a5; color: var(--amber); }
.stock-btns .btn[disabled] svg { color: var(--muted); }

.stock-item {
    background: var(--green-softer);
    border: 1px solid #d9efe2;
    border-radius: 10px;
    padding: 11px 13px;
    margin-bottom: 18px;
}
.stock-item .name { font-weight: 600; font-size: 14px; color: var(--ink); }
.stock-item .sub  { font-size: 12.3px; color: var(--muted); margin-top: 2px; }

/* ---------------------------------------------------------
   Compact forms - fewer pixels per field, less scrolling
   --------------------------------------------------------- */
@media (min-width: 993px) {
    .card           { margin-bottom: 14px; }
    .card-head      { padding: 12px 16px; }
    .card-body      { padding: 14px 16px; }
    .card-foot      { padding: 11px 16px; }
    .form-grid      { gap: 12px 14px; }
    .field          { gap: 4px; }
    .input,
    select.input    { height: 38px; }
    textarea.input  { min-height: 62px; padding: 8px 11px; }
    .page           { padding: 18px 22px 30px; }
    .page-head      { margin-bottom: 14px; }
    .kpi            { padding: 14px 16px; }
    .kpi-value      { font-size: 22px; margin: 4px 0 2px; }
}

/* ---------------------------------------------------------
   Order sheet - the whole order on one card
   --------------------------------------------------------- */
.order-sheet .sheet-head { padding-bottom: 6px; }

.sheet-type {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    margin-bottom: 14px;
}
.sheet-type .seg.seg-3 { flex: 0 1 420px; }
.sheet-type .seg-opt span { height: 38px; }
.sheet-type-label { font-size: 15px; font-weight: 700; color: var(--ink-2); }

.sheet-row {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(170px, 1fr);
    gap: 14px;
    align-items: start;
}

table.sheet-lines thead th { background: #f6f8f7; }
table.sheet-lines td { padding: 6px 10px; vertical-align: middle; }
table.sheet-lines .input { height: 36px; }
table.sheet-lines .num-input { text-align: right; }
table.sheet-lines .line-amount {
    font-weight: 700; color: var(--ink);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
table.sheet-lines tr.sheet-total td {
    background: #fafbfa; font-weight: 700; padding: 10px;
}

.sheet-addrow {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 16px;
    border-top: 1px solid var(--line-2);
}

.sheet-foot {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(260px, 340px);
    gap: 18px;
    align-items: start;
    border-top: 1px solid var(--line-2);
}
.sheet-notes { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.order-sheet:not(:has(.sum-box)) .sheet-foot { grid-template-columns: 1fr; }

.sum-box {
    display: grid; gap: 8px;
    background: #fafbfa;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 12px;
}
.sum-row {
    display: grid; grid-template-columns: 80px 1fr;
    align-items: center; gap: 10px;
    font-size: 13px; font-weight: 600; color: var(--ink-2);
}
.sum-row .input { height: 36px; text-align: right; }
.sum-balance .balance-box {
    padding: 6px 12px; font-size: 18px; justify-content: flex-end;
}

.sheet-actions { gap: 10px; }
.btn-share { color: #128c4b; border-color: #b9e6cd; }
.btn-share:hover { background: var(--green-soft); }

@media (max-width: 760px) {
    .sheet-row, .sheet-foot { grid-template-columns: 1fr; }
}

/* a row whose expected date has passed */
tr.row-late td            { background: #fdeaea; }
tr.row-late:hover td      { background: #fbe0e0; }
tr.row-late td:first-child { box-shadow: inset 3px 0 0 var(--red); }

/* per line image thumbs on the order form */
.line-thumbs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 5px; }
.line-thumb  { position: relative; display: inline-block; }
.line-thumb img,
.line-thumb .pdf {
    width: 34px; height: 34px;
    border-radius: 6px; border: 1px solid var(--line);
    object-fit: cover; background: #fff;
    display: grid; place-items: center; color: var(--red);
}
.line-thumb .x {
    position: absolute; top: -5px; right: -5px;
    width: 16px; height: 16px; line-height: 14px;
    border-radius: 50%; border: 1px solid var(--line);
    background: #fff; color: var(--red);
    font-size: 12px; cursor: pointer; padding: 0;
}
.file-slim { height: 32px; padding: 4px 6px; font-size: 11.5px; }
.file-slim::file-selector-button {
    height: 22px; padding: 0 8px; margin-right: 7px;
    border: 1px solid var(--line); border-radius: 6px;
    background: #fff; font: inherit; font-size: 11px; cursor: pointer;
}

/* Stage badge that opens the change-stage popup */
.stage-btn {
    display: inline-flex; align-items: center; gap: 4px;
    border: 1px solid transparent;
    background: none;
    padding: 2px 4px 2px 2px;
    border-radius: 20px;
    cursor: pointer;
    font-family: inherit;
    color: var(--muted);
}
.stage-btn:hover { border-color: var(--line); background: #fff; color: var(--ink-2); }
.stage-btn svg   { opacity: .65; }

/* Add-note box above a timeline */
.note-add { display: flex; gap: 10px; align-items: flex-start; }
.note-add textarea { flex: 1; min-height: 44px; }
.note-add .btn { white-space: nowrap; }
.note-add .note-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.note-add .note-main textarea { width: 100%; }

[hidden] { display: none !important; }

/* voice notes: recorder in the note box, player on the timeline */
.voice-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.voice-bar audio { height: 34px; max-width: 260px; }
.voice-bar label.btn { cursor: pointer; }
.voice-timer { font-variant-numeric: tabular-nums; font-weight: 700; }
.voice-live {
    width: 10px; height: 10px; border-radius: 50%;
    background: var(--red);
    animation: voice-pulse 1s ease-in-out infinite;
}
@keyframes voice-pulse { 50% { opacity: .25; } }
.voice-msg { font-size: 12px; }
.tl-voice { display: flex; align-items: center; gap: 10px; margin-top: 6px; font-size: 12px; }
.tl-voice audio { height: 34px; width: 100%; max-width: 320px; }
@media (max-width: 600px) {
    .note-add { flex-direction: column; align-items: stretch; }
    .voice-bar audio { max-width: 100%; flex: 1 1 100%; }
}
@media print { .tl-voice { display: none; } }
.timeline li.note::before { background: var(--line-2); }
.timeline li.note .tl-dot { background: var(--blue-soft); color: var(--blue); }

/* Customer order amounts + attachments */
.balance-box {
    display: flex; align-items: baseline; gap: 10px;
    background: var(--green-soft);
    border: 1px solid #b9e6cd;
    border-radius: var(--radius-sm);
    padding: 10px 13px;
    font-size: 20px; font-weight: 700; color: var(--green-dark);
    font-variant-numeric: tabular-nums;
}
.balance-box.negative { background: var(--red-soft); border-color: #fbbdbd; color: var(--red); }

.img-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
    gap: 10px;
}
.img-tile {
    position: relative;
    margin: 0;
    border: 1px solid var(--line);
    border-radius: 10px;
    overflow: hidden;
    background: #fafbfa;
}
.img-tile img {
    display: block; width: 100%; height: 86px;
    object-fit: cover; background: #fff;
}
.img-tile .pdf {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
    height: 86px; color: var(--red);
    font-size: 11px; font-weight: 700;
}
.img-tile figcaption {
    padding: 5px 7px;
    font-size: 10.8px; color: var(--muted);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    border-top: 1px solid var(--line-2);
    background: #fff;
}
.img-tile .img-drop {
    position: absolute; top: 4px; right: 4px;
    background: rgba(255, 255, 255, .92);
    border: 1px solid var(--line);
}

/* Segmented radio (Stock In / Stock Out, order type) */
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.seg.seg-3 { grid-template-columns: repeat(3, 1fr); max-width: 520px; }
.seg-opt.repair input:checked + span {
    background: var(--amber-soft); border-color: var(--amber); color: var(--amber);
    box-shadow: 0 0 0 3px #fdf6ea;
}
.seg-opt.sale input:checked + span {
    background: var(--green-soft); border-color: var(--green); color: var(--green-dark);
    box-shadow: 0 0 0 3px var(--green-softer);
}
.seg-opt.shop input:checked + span {
    background: var(--blue-soft); border-color: var(--blue); color: var(--blue);
    box-shadow: 0 0 0 3px #eef4ff;
}
.seg-opt input { position: absolute; opacity: 0; pointer-events: none; }
.seg-opt span {
    display: flex; align-items: center; justify-content: center; gap: 7px;
    height: 42px;
    border: 1px solid var(--line);
    border-radius: 10px;
    font-size: 13.5px; font-weight: 600; color: var(--ink-2);
    background: #fff;
    cursor: pointer;
    transition: background .14s, border-color .14s, color .14s;
}
.seg-opt span:hover { background: var(--line-2); }
.seg-opt.in  input:checked + span {
    background: var(--green-soft); border-color: var(--green); color: var(--green-dark);
    box-shadow: 0 0 0 3px var(--green-softer);
}
.seg-opt.out input:checked + span {
    background: var(--amber-soft); border-color: var(--amber); color: var(--amber);
    box-shadow: 0 0 0 3px #fdf6ea;
}

/* ---------------------------------------------------------
   Orders: ageing chips and the stage timeline
   --------------------------------------------------------- */
.age {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 20px;
    font-size: 11.8px; font-weight: 600;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.age-fresh { background: var(--green-soft); color: var(--green-dark); }
.age-watch { background: var(--amber-soft); color: var(--amber); }
.age-late  { background: var(--red-soft);   color: var(--red); }

/* Customer / supplier picker */
.party-picker { position: relative; }
.party-picker .input-group { gap: 8px; }
.party-picker [data-party-add] { width: 42px; padding: 0; }

.picker-chosen {
    display: flex; align-items: center; gap: 10px;
    border: 1px solid #b9e6cd;
    background: var(--green-softer);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    min-height: 40px;
}
.picker-chosen .pc-ic {
    width: 28px; height: 28px; border-radius: 8px;
    display: grid; place-items: center;
    background: #fff; color: var(--green-dark);
    border: 1px solid #cdeadb;
}
.picker-chosen .pc-text { line-height: 1.25; min-width: 0; }
.picker-chosen .pc-text b { font-size: 13.5px; display: block; }
.picker-chosen .pc-text .sub { font-size: 11.8px; color: var(--muted); }
.picker-chosen [data-party-clear] { margin-left: auto; }

.picker-results {
    position: absolute; left: 0; right: 0; top: calc(100% + 4px);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
    box-shadow: var(--shadow-md);
    max-height: 260px; overflow-y: auto;
    z-index: 70;
    padding: 5px;
}
.pr-item {
    display: block; width: 100%; text-align: left;
    border: 0; background: none; cursor: pointer;
    padding: 8px 10px; border-radius: 7px;
    font-family: inherit;
}
.pr-item:hover { background: var(--green-soft); }
.pr-item b    { display: block; font-size: 13.3px; color: var(--ink); }
.pr-item span { display: block; font-size: 11.8px; color: var(--muted); }
.pr-empty { padding: 10px; font-size: 12.5px; color: var(--muted); }

/* Stage strip (purchase book progress) */
.stage-strip { display: flex; gap: 6px; flex-wrap: wrap; }
.stage-step {
    flex: 1 1 120px;
    display: flex; align-items: center; gap: 8px;
    padding: 9px 11px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    font-size: 12.5px; color: var(--muted);
    min-width: 0;
}
.stage-step .ss-dot {
    width: 22px; height: 22px; border-radius: 50%;
    display: grid; place-items: center;
    background: var(--line-2); color: var(--muted);
    flex-shrink: 0;
}
.stage-step .ss-label { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stage-step .ss-age {
    margin-left: auto;
    font-size: 11px; font-weight: 700;
    color: var(--amber); white-space: nowrap;
}
.stage-step.done { border-color: #b9e6cd; background: var(--green-softer); color: var(--green-dark); }
.stage-step.done .ss-dot { background: var(--green-soft); color: var(--green-dark); }
.stage-step.at {
    border-color: var(--green); background: var(--green-soft); color: var(--green-dark);
    box-shadow: 0 0 0 3px var(--green-softer);
}
.stage-step.at .ss-dot { background: var(--green); color: #fff; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li {
    position: relative;
    padding: 0 0 18px 34px;
}
.timeline li::before {           /* the connecting line */
    content: "";
    position: absolute;
    left: 11px; top: 24px; bottom: 0;
    width: 2px; background: var(--line);
}
.timeline li:last-child::before { display: none; }

.tl-dot {
    position: absolute; left: 0; top: 1px;
    width: 24px; height: 24px; border-radius: 50%;
    display: grid; place-items: center;
    background: var(--line-2); color: var(--muted);
    border: 2px solid #fff;
}
.timeline li.now .tl-dot { background: var(--green-soft); color: var(--green-dark); }

.tl-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tl-head .spacer { margin-left: auto; }
.tl-note {
    margin-top: 6px;
    font-size: 13.2px; color: var(--ink-2);
    background: #fafbfa;
    border: 1px solid var(--line-2);
    border-radius: 8px;
    padding: 8px 11px;
}
.tl-meta { margin-top: 5px; font-size: 11.8px; color: var(--muted); }

/* order line inputs sit flush inside the table */
#lineTable td { padding: 7px 10px; }
#lineTable .input { height: 36px; }
#lineTable .num-input { text-align: right; }

/* shown only on paper */
.print-only { display: none; }

/* ---------------------------------------------------------
   Print: a clean sheet of paper, one line per row
   --------------------------------------------------------- */
@media print {
    @page { size: A4 landscape; margin: 10mm; }

    .sidebar, .topbar, .page-actions, .toolbar, .pagination,
    .kpi-grid, .card-foot, .breadcrumb, .no-print { display: none !important; }

    .print-only { display: block; }

    body { background: #fff; }
    .main { margin-left: 0 !important; }
    .page { padding: 0; }
    .card { border: 0; box-shadow: none; margin: 0 0 8px; }
    .card-head { padding: 0 0 6px; border: 0; }

    .page-head   { margin-bottom: 8px; }
    .page-title  { font-size: 17px; }
    .print-meta  { font-size: 10px; color: #333; line-height: 1.55; margin-top: 4px; }
    .print-meta b { color: #000; }

    /* one item = one line */
    table.tbl { font-size: 9.6px; width: 100% !important; }
    table.tbl th, table.tbl td {
        padding: 3px 5px !important;
        width: auto !important;
        white-space: nowrap;
    }
    table.tbl thead th { background: #f2f2f2 !important; font-size: 8.6px; letter-spacing: 0; }
    table.tbl tbody tr, table.tbl tfoot tr { page-break-inside: avoid; }
    table.tbl thead { display: table-header-group; }      /* repeat the header on every page */
    table.tbl .sub { display: none; }                      /* no second line under a cell */
    .col-min { display: none !important; }                 /* Min is screen only */

    .badge, .age {
        padding: 1px 5px; font-size: 8.6px;
        -webkit-print-color-adjust: exact; print-color-adjust: exact;
    }
    table.sheet tr.grp td, table.sheet tr.zero td {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}

/* ---------------------------------------------------------
   Responsive
   --------------------------------------------------------- */
.backdrop-nav {
    position: fixed; inset: 0; background: rgba(16,24,40,.4);
    z-index: 35; display: none;
}
body.nav-open .backdrop-nav { display: block; }

@media (max-width: 1100px) {
    .search { max-width: 260px; }
}

@media (max-width: 992px) {
    .sidebar { transform: translateX(-100%); transition: transform .22s ease; }
    body.nav-open .sidebar { transform: none; box-shadow: var(--shadow-md); }
    .main { margin-left: 0; }
    .login-wrap { grid-template-columns: 1fr; }
    .login-art { display: none; }
}

@media (max-width: 720px) {
    .page { padding: 18px 14px 34px; }
    .topbar { padding: 0 14px; gap: 10px; }
    .search { display: none; }
    .user-meta { display: none; }
    .page-actions { width: 100%; }
    .toolbar .search { display: block; width: 100%; flex: 1 1 100%; }
    .field.col-2 { grid-column: span 1; }
    .kpi-value { font-size: 22px; }
}

/* =========================================================
   WhatsApp share popup + templates page
   ========================================================= */
.btn-share svg { color: #25d366; }
.wa-modal .modal-head h3 { display: flex; align-items: center; gap: 8px; }
.wa-modal .modal-head h3 svg { color: #25d366; }
.wa-tabs { display: flex; gap: 6px; margin-bottom: 12px; border-bottom: 1px solid var(--line-2); }
.wa-tab {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 14px; margin-bottom: -1px;
    background: none; border: 0; border-bottom: 2px solid transparent;
    font: inherit; font-weight: 600; font-size: 13px; color: var(--muted); cursor: pointer;
}
.wa-tab.active { color: var(--green-dark); border-bottom-color: var(--green); }
.wa-text { font-size: 13px; line-height: 1.5; resize: vertical; min-height: 180px; }
.wa-help { font-size: 11.5px; margin-top: 4px; }
.wa-targets { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; margin-top: 12px; }
.wa-send {
    display: flex; align-items: center; gap: 10px; text-align: left;
    padding: 9px 12px; border-radius: 10px;
    border: 1px solid #b9e6cd; background: #f3fbf6; color: var(--ink);
    font: inherit; cursor: pointer;
}
.wa-send:hover { background: #e3f6ea; border-color: #25d366; }
.wa-send svg { color: #25d366; flex-shrink: 0; }
.wa-send span { display: flex; flex-direction: column; min-width: 0; font-size: 13px; }
.wa-send small { color: var(--muted); font-size: 11.5px; }
.wa-send.disabled { opacity: .55; cursor: not-allowed; background: #fafbfa; border-color: var(--line-2); }
.wa-send.wa-pick, .wa-send.wa-copy { background: #fff; border-style: dashed; border-color: var(--line); }
.wa-send.wa-pick svg, .wa-send.wa-copy svg { color: var(--muted); }

.wa-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.wa-chip {
    font: 600 12px Consolas, monospace; padding: 4px 8px; border-radius: 6px;
    border: 1px solid var(--line); background: #fafbfa; color: var(--green-dark); cursor: pointer;
}
.wa-chip:hover:not(:disabled) { background: var(--green-soft); }
.wa-tpl-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.wa-tpl-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 13.5px; }
.wa-tpl-text { font: 13px/1.5 Consolas, "Segoe UI", monospace; resize: vertical; }
.wa-tpl-foot { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; font-size: 12.5px; }
.wa-tpl-foot label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.wa-tpl-foot summary { cursor: pointer; color: var(--muted); }
.wa-preview {
    margin: 6px 0 0; padding: 10px 12px; white-space: pre-wrap; font: 13px/1.5 "Segoe UI", Arial, sans-serif;
    background: #e7f8ee; border: 1px solid #c9ecd7; border-radius: 10px;
}

/* recorder inside the add / edit forms */
.voice-field .lbl { display: inline-flex; align-items: center; gap: 5px; }
.sheet-notes .voice-field { grid-column: 1 / -1; }

/* =========================================================
   ALL CAPITALS in every text box / text area
   (app.js also converts the value, so it is saved in capitals).
   Login names, e-mails and the WhatsApp message boxes keep their case.
   ========================================================= */
input:not([type]), input[type="text"], input[type="search"], textarea {
    text-transform: uppercase;
}
input[name="username"], input[name="email"], [data-wa-text], [data-wa-tpl], [data-no-caps] {
    text-transform: none;
}
input::placeholder, textarea::placeholder { text-transform: none; }

/* =========================================================
   Repair order: device / problems / assignee / photos
   ========================================================= */
.repair-block {
    display: grid; gap: 14px; margin-top: 14px; padding: 14px;
    border: 1px solid var(--line-2); border-radius: 12px; background: #fbfdfc;
}
.repair-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.tag-box {
    display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
    min-height: 42px; padding: 5px 8px;
    border: 1px solid var(--line); border-radius: 10px; background: #fff; cursor: text;
}
.tag-box:focus-within { border-color: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.tag-list { display: contents; }
.tag-input { flex: 1; min-width: 160px; border: 0; outline: 0; font: inherit; font-size: 13.5px; padding: 5px 2px; background: transparent; }
.tag-chip {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 4px 3px 10px; border-radius: 999px;
    background: var(--amber-soft, #fef3c7); color: #92400e; font-size: 12px; font-weight: 700;
}
.tag-chip:not(:has(.tag-x)) { padding-right: 10px; }
.tag-x {
    width: 18px; height: 18px; border: 0; border-radius: 50%; padding: 0;
    background: rgba(0,0,0,.08); color: inherit; font-size: 13px; line-height: 1; cursor: pointer;
}
.tag-x:hover { background: rgba(0,0,0,.18); }
.tag-suggest { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tag-pick {
    padding: 3px 9px; border-radius: 999px; border: 1px dashed var(--line);
    background: #fff; color: var(--muted); font: inherit; font-size: 11.5px; font-weight: 600; cursor: pointer;
}
.tag-pick:hover { border-color: var(--green); color: var(--green-dark); }
.tags-inline { display: flex; flex-wrap: wrap; gap: 5px; }
.sheet-subhead { padding: 12px 18px 0; font-weight: 700; font-size: 13.5px; }
.parts-toggle { border-top: 1px solid var(--line-2); }
