/* ============================================================
   Returns Desk — styles
   Theme: calm support workspace, "paper ticket stub" cards.
   Status carries the color story; chrome stays quiet.
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Sora:wght@500;600;700&family=Inter:wght@400;500;600&family=IBM+Plex+Mono:wght@500&display=swap');

:root {
    --bg:        #F4F5F7;
    --surface:   #FFFFFF;
    --ink:       #18212E;
    --ink-soft:  #687385;
    --ink-faint: #9AA3B0;
    --line:      #E5E8EE;
    --line-soft: #EFF1F5;
    --brand:     #1B2433;
    --accent:    #0F766E;     /* teal — primary actions, focus */
    --accent-ink:#0B5A53;

    /* status: text / fill / rail */
    --open-ink:  #92500E;  --open-bg:  #FBEFD9;  --open-rail:  #E08A1E;
    --prog-ink:  #1E4F8A;  --prog-bg:  #E6EEFB;  --prog-rail:  #3B82C4;
    --closed-ink:#0F6F5C;  --closed-bg:#E4F1EC;  --closed-rail:#2FA98C;

    --radius: 10px;
    --shadow: 0 1px 2px rgba(24,33,46,.05), 0 1px 8px rgba(24,33,46,.04);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

/* ---------- brand mark with ticket stub ---------- */
.brand, .login-mark { display: flex; align-items: center; gap: 10px; }
.brand-name { font-family: 'Sora', sans-serif; font-weight: 700; letter-spacing: -.01em; }
.stub {
    width: 16px; height: 22px; border-radius: 3px;
    background: var(--accent);
    position: relative; flex: none;
    -webkit-mask: radial-gradient(circle 3px at 50% 0, transparent 98%, #000) top,
                  radial-gradient(circle 3px at 50% 100%, transparent 98%, #000) bottom;
    -webkit-mask-size: 100% 51%; -webkit-mask-repeat: no-repeat;
    mask: radial-gradient(circle 3px at 50% 0, transparent 98%, #000) top,
          radial-gradient(circle 3px at 50% 100%, transparent 98%, #000) bottom;
    mask-size: 100% 51%; mask-repeat: no-repeat;
}

/* ---------- top bar ---------- */
.topbar {
    position: sticky; top: 0; z-index: 20;
    display: flex; align-items: center; justify-content: space-between;
    gap: 16px; padding: 12px 22px;
    background: var(--brand); color: #fff;
}
.topbar .brand-name { color: #fff; }
.topbar .stub { background: #fff; }
.topbar-tools { display: flex; align-items: center; gap: 10px; }
.search input {
    width: 240px; max-width: 42vw;
    padding: 9px 13px; border-radius: 8px; border: 1px solid transparent;
    background: rgba(255,255,255,.12); color: #fff; font-size: 14px;
}
.search input::placeholder { color: rgba(255,255,255,.6); }
.search input:focus { outline: none; background: #fff; color: var(--ink); }

/* ---------- buttons ---------- */
.btn {
    font: inherit; font-size: 14px; font-weight: 500;
    padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line);
    background: var(--surface); color: var(--ink); cursor: pointer;
    text-decoration: none; display: inline-flex; align-items: center; gap: 7px;
    transition: background .12s, border-color .12s, transform .05s;
}
.btn:hover { background: #fafbfc; }
.btn:active { transform: scale(.985); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-ink); }
.btn-ghost {
    background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.18); color: #fff;
}
.btn-ghost:hover { background: rgba(255,255,255,.2); }
.btn-block { width: 100%; justify-content: center; margin-top: 6px; }
.btn-sm { padding: 6px 11px; font-size: 13px; }
.btn[disabled] { opacity: .55; cursor: default; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- board ---------- */
.board {
    display: grid; grid-template-columns: repeat(3, 1fr);
    gap: 16px; padding: 20px 22px; align-items: start;
}
.column {
    background: var(--line-soft); border-radius: 14px; padding: 12px;
    min-height: 180px;
}
.col-head {
    display: flex; align-items: center; gap: 8px;
    font-family: 'Sora', sans-serif; font-weight: 600; font-size: 14px;
    color: var(--ink); padding: 4px 6px 12px;
}
.col-head .count {
    margin-left: auto; font-family: 'Inter'; font-weight: 600; font-size: 12px;
    color: var(--ink-soft); background: #fff; border: 1px solid var(--line);
    border-radius: 20px; padding: 1px 9px;
}
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.dot-open { background: var(--open-rail); }
.dot-prog { background: var(--prog-rail); }
.dot-closed { background: var(--closed-rail); }
.col-body { display: flex; flex-direction: column; gap: 10px; }

/* ---------- ticket card (stub motif) ---------- */
.card {
    position: relative; background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 13px 15px 13px 20px;
    cursor: pointer; box-shadow: var(--shadow);
    transition: border-color .12s, transform .06s;
}
.card:hover { border-color: #d4d9e2; }
.card:active { transform: scale(.992); }
/* perforated colored rail on the left */
.card::before {
    content: ""; position: absolute; left: 7px; top: 11px; bottom: 11px; width: 3px;
    border-radius: 3px; background: var(--ink-faint);
}
.card[data-s="open"]::before { background: var(--open-rail); }
.card[data-s="in_progress"]::before { background: var(--prog-rail); }
.card[data-s="closed"]::before { background: var(--closed-rail); }
.card.is-closed { opacity: .82; }

.card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.order-no {
    font-family: 'IBM Plex Mono', monospace; font-weight: 500; font-size: 13px;
    color: var(--ink); letter-spacing: -.02em;
}
.badge {
    font-size: 11px; font-weight: 600; padding: 2px 9px; border-radius: 20px;
    letter-spacing: .01em; white-space: nowrap;
}
.badge-open    { color: var(--open-ink);   background: var(--open-bg); }
.badge-in_progress { color: var(--prog-ink); background: var(--prog-bg); }
.badge-closed  { color: var(--closed-ink);  background: var(--closed-bg); }

.card-cust { font-weight: 600; font-size: 14px; margin: 7px 0 2px; }
.card-meta { font-size: 12.5px; color: var(--ink-soft); display: flex; gap: 10px; flex-wrap: wrap; }
.card-total { font-weight: 600; color: var(--ink); }

.empty {
    text-align: center; color: var(--ink-faint); font-size: 13px;
    padding: 26px 8px; border: 1px dashed var(--line); border-radius: var(--radius);
}

/* ---------- drawer ---------- */
.drawer-overlay {
    position: fixed; inset: 0; background: rgba(20,28,40,.38); z-index: 40;
    display: none;
}
.drawer-overlay.is-open { display: block; }
.drawer {
    position: fixed; top: 0; right: 0; height: 100%; width: 440px; max-width: 94vw;
    background: var(--surface); z-index: 50; box-shadow: -8px 0 30px rgba(20,28,40,.16);
    display: none; flex-direction: column;
}
.drawer.is-open { display: flex; animation: slideIn .18s ease; }
@keyframes slideIn { from { transform: translateX(20px); opacity: .4; } to { transform: none; opacity: 1; } }
.drawer-head {
    display: flex; align-items: flex-start; justify-content: space-between;
    padding: 18px 20px 14px; border-bottom: 1px solid var(--line);
}
.drawer-head h2 { font-family: 'Sora'; font-size: 16px; margin: 0 0 5px; }
.drawer-close {
    border: none; background: none; font-size: 22px; line-height: 1; cursor: pointer;
    color: var(--ink-soft); padding: 2px 6px; border-radius: 6px;
}
.drawer-close:hover { background: var(--line-soft); }
.drawer-body { padding: 16px 20px 22px; overflow-y: auto; flex: 1; }

.section-label {
    font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
    color: var(--ink-faint); margin: 18px 0 8px;
}
.section-label:first-child { margin-top: 0; }

.kv { display: flex; justify-content: space-between; gap: 12px; font-size: 13.5px; padding: 5px 0; border-bottom: 1px solid var(--line-soft); }
.kv span:first-child { color: var(--ink-soft); }
.kv a { color: var(--accent-ink); text-decoration: none; }

.items li { display: flex; justify-content: space-between; gap: 10px; font-size: 13.5px; padding: 5px 0; list-style: none; }
.items { margin: 0; padding: 0; }
.items .qty { color: var(--ink-soft); font-family: 'IBM Plex Mono', monospace; font-size: 12px; }

/* status switcher */
.status-row { display: flex; gap: 8px; margin-top: 6px; }
.status-row .btn { flex: 1; justify-content: center; }
.status-row .btn.active[data-set="open"]        { border-color: var(--open-rail);   color: var(--open-ink);   background: var(--open-bg); }
.status-row .btn.active[data-set="in_progress"] { border-color: var(--prog-rail);   color: var(--prog-ink);   background: var(--prog-bg); }
.status-row .btn.active[data-set="closed"]      { border-color: var(--closed-rail); color: var(--closed-ink); background: var(--closed-bg); }

/* notes */
.note {
    background: var(--line-soft); border-radius: 8px; padding: 9px 12px; margin-bottom: 8px;
    font-size: 13.5px; line-height: 1.5;
}
.note .meta { font-size: 11.5px; color: var(--ink-soft); margin-top: 4px; }
.note-form { margin-top: 12px; }
.note-form input, .note-form textarea {
    width: 100%; font: inherit; font-size: 13.5px; padding: 9px 11px;
    border: 1px solid var(--line); border-radius: 8px; margin-bottom: 8px; resize: vertical;
}
.note-form input:focus, .note-form textarea:focus { outline: none; border-color: var(--accent); }

/* ---------- toast ---------- */
.toast {
    position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
    background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 8px;
    font-size: 13.5px; z-index: 60; box-shadow: var(--shadow);
}

/* ---------- login ---------- */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-card {
    background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
    padding: 32px 30px; width: 360px; max-width: 92vw; box-shadow: var(--shadow);
}
.login-mark { margin-bottom: 18px; font-family: 'Sora'; font-weight: 700; font-size: 16px; }
.login-card h1 { font-family: 'Sora'; font-size: 22px; margin: 0 0 4px; }
.login-card .muted { color: var(--ink-soft); font-size: 13.5px; margin: 0 0 18px; }
.login-card label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; }
.login-card input {
    width: 100%; padding: 11px 13px; font: inherit; font-size: 14px;
    border: 1px solid var(--line); border-radius: 9px;
}
.login-card input:focus { outline: none; border-color: var(--accent); }
.alert { background: #FCEBEB; color: #A32D2D; font-size: 13px; padding: 9px 12px; border-radius: 8px; margin-bottom: 14px; }

@media (max-width: 820px) {
    .board { grid-template-columns: 1fr; }
    .search input { width: 150px; }
}
@media (prefers-reduced-motion: reduce) {
    * { animation: none !important; transition: none !important; }
}

/* ---------- user chip (topbar) ---------- */
.user-chip {
    display: inline-flex; align-items: center; gap: 6px;
    background: rgba(255,255,255,.14); color: #fff;
    font-size: 13px; font-weight: 600; padding: 7px 12px; border-radius: 20px;
    max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ---------- danger button ---------- */
.btn-danger { color: #A32D2D; border-color: #F0C7C7; background: #FCEFEF; }
.btn-danger:hover { background: #F9E3E3; }

/* ---------- system (audit) note ---------- */
.note-sys {
    background: transparent; border: 1px dashed var(--line);
    color: var(--ink-soft); font-size: 12.5px;
}

/* ---------- team / generic page ---------- */
.page { max-width: 720px; margin: 0 auto; padding: 26px 22px 40px; }
.page-title { font-family: 'Sora'; font-size: 24px; margin: 0 0 4px; }
.page-sub { color: var(--ink-soft); font-size: 14px; margin: 0 0 22px; }

.panel {
    background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
    padding: 18px 20px; margin-bottom: 18px; box-shadow: var(--shadow);
}
.panel-title { font-family: 'Sora'; font-size: 15px; margin: 0 0 14px; }

.add-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.add-form input {
    flex: 1; min-width: 150px; font: inherit; font-size: 14px;
    padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px;
}
.add-form input:focus { outline: none; border-color: var(--accent); }
.add-form .btn { padding: 10px 18px; }

.member {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 11px 2px; border-bottom: 1px solid var(--line-soft); font-size: 14.5px;
}
.member:last-child { border-bottom: none; }
.member.leader { background: var(--line-soft); border-radius: 8px; padding: 11px 12px; margin-bottom: 6px; }
.tag-admin {
    font-size: 11px; font-weight: 600; color: var(--accent-ink);
    background: var(--closed-bg); padding: 2px 8px; border-radius: 20px; margin-left: 6px;
}

.banner { padding: 11px 14px; border-radius: 9px; font-size: 13.5px; margin-bottom: 16px; }
.banner.ok  { background: var(--closed-bg); color: var(--closed-ink); }
.banner.bad { background: #FCEBEB; color: #A32D2D; }
.muted { color: var(--ink-soft); }

/* search emphasis */
.search input { transition: background .12s; }
