:root {
    --ink: #2b2410;
    --ink-soft: #6b5f3d;
    --ink-mute: #a3966b;
    --glass-bg: rgba(255,255,255,0.72);
    --glass-bg-strong: rgba(255,255,255,0.9);
    --glass-border: rgba(255,255,255,1);
    --accent: #e08a1f;
    --accent-2: #0f9d8f;
    --amber: #c97a12;
    --red: #d64550;
    --radius-lg: 22px;
    --radius-md: 14px;
  }
  * { box-sizing: border-box; }
  html, body {
    margin: 0; padding: 0;
    font-family: 'Inter', sans-serif;
    color: var(--ink);
    background: linear-gradient(150deg, #FFFDF9 0%, #FFF8EE 45%, #FFF2E2 100%);
    min-height: 100vh;
  }
  .bg-blob {
    position: fixed; border-radius: 50%;
    filter: blur(90px); opacity: 0.22; z-index: 0; pointer-events: none;
  }
  .blob-1 { width: 440px; height: 440px; background: #FFE7A8; top: -140px; left: -100px; }
  .blob-2 { width: 380px; height: 380px; background: #FFC59C; bottom: -110px; right: -80px; }
  .blob-3 { width: 300px; height: 300px; background: #FFD8E8; top: 45%; right: 6%; opacity: 0.25; }

  .app { position: relative; z-index: 1; display: flex; min-height: 100vh; }

  .sidebar {
    width: 224px; flex-shrink: 0;
    padding: 26px 16px;
    display: flex; flex-direction: column; gap: 5px;
  }
  .brand-row { display: flex; align-items: center; gap: 9px; padding: 0 10px 6px; }
  .brand-icon {
    width: 32px; height: 32px; border-radius: 10px; flex-shrink: 0;
    background: linear-gradient(135deg, var(--accent), #ffb454);
    display: flex; align-items: center; justify-content: center;
  }
  .brand { font-family: 'Outfit', sans-serif; font-weight: 700; font-size: 17px; letter-spacing: -0.02em; }
  .brand span { color: var(--accent); }

  .bot-badge {
    display: flex; align-items: center; gap: 8px;
    margin: 4px 10px 20px; padding: 9px 12px;
    background: rgba(15,157,143,0.13); border: 1px solid rgba(15,157,143,0.25);
    border-radius: 12px; font-size: 11.5px; font-weight: 600; color: #0b6d63;
    line-height: 1.4;
  }
  .bot-dot {
    width: 7px; height: 7px; border-radius: 50%; background: #0f9d8f; flex-shrink: 0;
    box-shadow: 0 0 0 3px rgba(15,157,143,0.22);
    animation: pulse 1.8s infinite;
  }
  @keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }

  .nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 11px 14px; border-radius: var(--radius-md);
    font-size: 14.5px; font-weight: 500; color: var(--ink-soft);
    cursor: pointer; transition: all 0.15s ease;
  }
  .nav-item:hover { background: rgba(255,255,255,0.45); }
  .nav-item.active {
    background: var(--glass-bg-strong);
    border: 1px solid var(--glass-border);
    color: var(--accent);
    box-shadow: 0 4px 16px rgba(224,138,31,0.16);
  }
  .nav-icon { width: 18px; height: 18px; flex-shrink: 0; }
  .nav-item.disabled { opacity: 0.4; cursor: not-allowed; }
  .nav-tag {
    margin-left: auto; font-size: 10px; background: rgba(0,0,0,0.06);
    padding: 2px 6px; border-radius: 6px; color: var(--ink-mute);
  }

  .main { flex: 1; padding: 24px 28px 60px; min-width: 0; }

  .topbar {
    display: flex; align-items: center; justify-content: space-between;
    gap: 14px; margin-bottom: 26px; flex-wrap: wrap; position: relative;
  }

  .dept-btn {
    display: flex; align-items: center; gap: 9px;
    background: var(--glass-bg); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
    border: 1px solid var(--glass-border);
    padding: 9px 16px 9px 8px; border-radius: 999px;
    font-size: 14px; font-weight: 600; cursor: pointer; color: var(--ink);
  }
  .dept-btn-icon {
    width: 26px; height: 26px; border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #ffb454);
    display: flex; align-items: center; justify-content: center; color: white;
  }
  .dept-btn .chev { width: 14px; height: 14px; color: var(--ink-mute); margin-left: 2px; }

  .dept-gallery {
    position: absolute; top: 52px; left: 0; z-index: 20;
    width: 340px; padding: 14px; display: none;
    grid-template-columns: 1fr 1fr; gap: 10px;
  }
  .dept-gallery.open { display: grid; }
  .dept-card {
    background: rgba(255,255,255,0.6); border: 1px solid rgba(255,255,255,0.9);
    border-radius: 14px; padding: 12px; cursor: pointer; text-align: left;
    transition: all 0.15s;
  }
  .dept-card:hover { background: rgba(255,255,255,0.85); transform: translateY(-1px); }
  .dept-card.selected { border: 1.5px solid var(--accent); background: rgba(255,255,255,0.9); }
  .dept-card-icon {
    width: 30px; height: 30px; border-radius: 9px; margin-bottom: 8px;
    background: linear-gradient(135deg, var(--accent), #ffb454);
    display: flex; align-items: center; justify-content: center; color: white;
  }
  .dept-card-name { font-size: 12.5px; font-weight: 600; margin-bottom: 2px; }
  .dept-card-meta { font-size: 10.5px; color: var(--ink-mute); }

  .user-chip {
    display: flex; align-items: center; gap: 10px;
    background: var(--glass-bg); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
    border: 1px solid var(--glass-border);
    padding: 6px 14px 6px 6px; border-radius: 999px; font-size: 13.5px; font-weight: 500;
  }
  .avatar {
    width: 28px; height: 28px; border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #ffb454);
    color: white; display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700;
  }

  h1 { font-family: 'Outfit', sans-serif; font-size: 23px; font-weight: 600; margin: 0 0 4px; }
  .subtitle { color: var(--ink-soft); font-size: 13.5px; margin: 0 0 22px; }

  .glass {
    background: var(--glass-bg);
    backdrop-filter: blur(22px); -webkit-backdrop-filter: blur(22px);
    border: 1px solid rgba(0,0,0,0.06);
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 30px rgba(120,80,20,0.07);
  }

  .content-grid { display: grid; grid-template-columns: 1.15fr 1fr; gap: 20px; align-items: start; }

  .panel { padding: 22px; }
  .panel h2 { display: flex; align-items: center; gap: 8px; font-family: 'Outfit', sans-serif; font-size: 15.5px; font-weight: 600; margin: 0 0 16px; }
  .panel h2 svg { width: 17px; height: 17px; color: var(--accent); }

  .field-label { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--ink-soft); margin: 14px 0 6px; }
  .field-label svg { width: 13px; height: 13px; color: var(--ink-mute); }
  .field-label:first-of-type { margin-top: 0; }
  .text-input, .num-input {
    width: 100%; padding: 10px 13px; border-radius: 11px;
    border: 1px solid rgba(0,0,0,0.08); background: rgba(255,255,255,0.7);
    font: inherit; font-size: 14px; outline: none; color: var(--ink);
  }
  .text-input:focus, .num-input:focus { border-color: var(--accent); background: white; }

  .chip-list { display: flex; flex-wrap: wrap; gap: 8px; }
  .chip {
    padding: 7px 13px; border-radius: 999px; font-size: 13px; font-weight: 500;
    background: rgba(255,255,255,0.55); border: 1px solid rgba(0,0,0,0.07);
    cursor: pointer; color: var(--ink-soft); transition: all 0.15s;
  }
  .chip.on { background: var(--accent); color: white; border-color: var(--accent); }

  .picker-btn {
    width: 100%; display: flex; align-items: center; justify-content: space-between;
    padding: 12px 14px; border-radius: 12px; cursor: pointer;
    background: rgba(255,255,255,0.55); border: 1px dashed rgba(0,0,0,0.15);
    font: inherit; font-size: 13.5px; font-weight: 500; color: var(--ink-soft);
  }
  .picker-btn:hover { background: rgba(255,255,255,0.8); border-style: solid; border-color: var(--accent); color: var(--accent); }
  .picker-btn-left { display: flex; align-items: center; gap: 9px; }
  .picker-btn svg { width: 16px; height: 16px; }
  .picker-count {
    background: var(--accent); color: white; font-size: 11px; font-weight: 700;
    padding: 2px 8px; border-radius: 999px;
  }

  .btn-primary {
    margin-top: 18px; width: 100%; padding: 12px; border: none; border-radius: 12px;
    display: flex; align-items: center; justify-content: center; gap: 8px;
    background: linear-gradient(135deg, var(--accent), #ffb454); color: white;
    font: inherit; font-size: 14.5px; font-weight: 600; cursor: pointer;
    box-shadow: 0 6px 18px rgba(224,138,31,0.32);
  }
  .btn-primary svg { width: 16px; height: 16px; }

  .right-col { display: flex; flex-direction: column; gap: 16px; }

  .usage-card { padding: 20px 22px; }
  .usage-title { display: flex; align-items: center; gap: 8px; font-family: 'Outfit', sans-serif; font-size: 14.5px; font-weight: 600; margin: 0 0 4px; }
  .usage-title svg { width: 16px; height: 16px; color: var(--accent); }
  .usage-sub { font-size: 12px; color: var(--ink-mute); margin: 0 0 16px; }
  .usage-row { display: flex; align-items: center; gap: 10px; margin-bottom: 11px; }
  .usage-row:last-child { margin-bottom: 0; }
  .usage-icon {
    width: 26px; height: 26px; border-radius: 8px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center; color: white;
  }
  .usage-icon svg { width: 13px; height: 13px; }
  .usage-icon.done { background: var(--accent-2); }
  .usage-icon.pending { background: var(--amber); }
  .usage-icon.failed { background: var(--red); }
  .usage-body { flex: 1; min-width: 0; }
  .usage-label-row { display: flex; justify-content: space-between; font-size: 12.5px; margin-bottom: 4px; }
  .usage-label-row b { font-weight: 700; }
  .usage-bar-track { height: 6px; border-radius: 999px; background: rgba(0,0,0,0.06); overflow: hidden; }
  .usage-bar-fill { height: 100%; border-radius: 999px; }
  .usage-bar-fill.done { background: var(--accent-2); }
  .usage-bar-fill.pending { background: var(--amber); }
  .usage-bar-fill.failed { background: var(--red); }

  .assign-box {
    background: rgba(255,255,255,0.55); border: 1px solid rgba(0,0,0,0.06);
    border-radius: 16px; padding: 16px;
  }
  .assign-box-label { font-size: 11.5px; font-weight: 600; color: var(--ink-mute); margin-bottom: 9px; }
  .people-pills { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
  .people-pill {
    display: flex; align-items: center; gap: 6px;
    background: var(--accent); color: white; font-size: 12.5px; font-weight: 600;
    padding: 6px 8px 6px 12px; border-radius: 999px;
  }
  .people-pill button {
    background: rgba(255,255,255,0.3); border: none; color: white; cursor: pointer;
    width: 16px; height: 16px; border-radius: 50%; font-size: 13px; line-height: 1;
    display: flex; align-items: center; justify-content: center; padding: 0;
  }
  .add-pill-btn {
    display: flex; align-items: center; gap: 5px;
    padding: 6px 12px; border-radius: 999px; border: 1px dashed rgba(0,0,0,0.2);
    background: transparent; font: inherit; font-size: 12.5px; font-weight: 600;
    color: var(--ink-soft); cursor: pointer;
  }
  .add-pill-btn:hover { border-color: var(--accent); color: var(--accent); border-style: solid; }
  .add-pill-btn svg { width: 13px; height: 13px; }

  .add-people-panel { display: none; margin-top: 12px; padding-top: 12px; border-top: 1px dashed rgba(0,0,0,0.1); }
  .add-people-panel.open { display: block; }
  .add-people-search input {
    width: 100%; padding: 8px 12px; border-radius: 10px; border: 1px solid rgba(0,0,0,0.08);
    background: white; font: inherit; font-size: 13px; outline: none; margin-bottom: 10px;
  }
  .add-people-list { display: flex; flex-wrap: wrap; gap: 7px; }
  .add-people-item {
    padding: 6px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 500;
    background: white; border: 1px solid rgba(0,0,0,0.08); cursor: pointer; color: var(--ink-soft);
  }
  .add-people-item:hover { border-color: var(--accent); color: var(--accent); }
  .add-people-item.added { display: none; }

  .log-header {
    display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px;
  }
  .log-stats { display: flex; gap: 6px; }
  .mini-pill {
    display: flex; align-items: center; gap: 4px;
    font-size: 11px; font-weight: 700; padding: 4px 9px; border-radius: 999px;
  }
  .mini-pill svg { width: 11px; height: 11px; }
  .mini-pill.pending { background: rgba(201,122,18,0.15); color: #8a5a0d; }
  .mini-pill.done { background: rgba(15,157,143,0.15); color: #0b6d63; }
  .mini-pill.failed { background: rgba(214,69,80,0.15); color: #a3313a; }

  .log-list { max-height: 480px; overflow-y: auto; padding-right: 4px; }
  .log-list::-webkit-scrollbar { width: 5px; }
  .log-list::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); border-radius: 4px; }

  .log-item {
    border-bottom: 1px solid rgba(0,0,0,0.06); padding: 13px 4px 13px 12px; cursor: pointer;
    border-left: 3px solid transparent; border-radius: 0 10px 10px 0; margin-bottom: 2px;
  }
  .log-item.st-done { border-left-color: var(--accent-2); background: rgba(15,157,143,0.05); }
  .log-item.st-pending { border-left-color: var(--amber); background: rgba(201,122,18,0.05); }
  .log-item.st-failed { border-left-color: var(--red); background: rgba(214,69,80,0.05); }
  .log-item:last-child { border-bottom: none; }
  .log-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
  .log-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
  .status-badge {
    display: flex; align-items: center; gap: 4px; flex-shrink: 0;
    padding: 4px 9px; border-radius: 999px; font-size: 10.5px; font-weight: 700;
  }
  .status-badge svg { width: 11px; height: 11px; }
  .status-badge.done { background: var(--accent-2); color: white; }
  .status-badge.pending { background: var(--amber); color: white; }
  .status-badge.failed { background: var(--red); color: white; }
  .log-wo { font-weight: 600; font-size: 13.5px; }
  .log-meta { font-size: 11.5px; color: var(--ink-mute); display: flex; gap: 8px; margin-top: 2px; flex-wrap: wrap; }
  .log-meta span { display: flex; align-items: center; gap: 3px; }
  .log-meta svg { width: 11px; height: 11px; }
  .chev-toggle { width: 14px; height: 14px; color: var(--ink-mute); transition: transform 0.2s; flex-shrink: 0; }
  .log-item.expanded .chev-toggle { transform: rotate(180deg); }

  .log-detail {
    display: none; margin-top: 10px; padding: 12px; border-radius: 12px;
    background: rgba(255,255,255,0.55); font-size: 12px; color: var(--ink-soft);
  }
  .log-item.expanded .log-detail { display: block; }
  .log-detail-row { display: flex; justify-content: space-between; padding: 4px 0; }
  .log-detail-row b { color: var(--ink); font-weight: 600; }
  .log-detail-employees { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 5px; }
  .mini-emp { background: rgba(255,255,255,0.9); padding: 3px 8px; border-radius: 999px; font-size: 11px; }
  .bot-note {
    margin-top: 8px; display: flex; align-items: center; gap: 6px;
    font-size: 11px; color: #0b6d63; font-weight: 600;
  }
  .bot-note svg { width: 13px; height: 13px; }

  .modal-overlay {
    display: none; position: fixed; inset: 0; z-index: 50;
    background: rgba(60,40,10,0.35); backdrop-filter: blur(4px);
    align-items: center; justify-content: center; padding: 20px;
  }
  .modal-overlay.open { display: flex; }
  .modal {
    width: 100%; max-width: 460px; max-height: 82vh; display: flex; flex-direction: column;
    background: rgba(255,252,244,0.92); backdrop-filter: blur(30px);
    border: 1px solid rgba(255,255,255,0.9); border-radius: 22px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  }
  .modal-head { padding: 18px 20px 12px; display: flex; align-items: center; justify-content: space-between; }
  .modal-head h3 { font-family: 'Outfit', sans-serif; font-size: 16px; font-weight: 600; margin: 0; }
  .modal-close { width: 30px; height: 30px; border-radius: 50%; border: none; background: rgba(0,0,0,0.06); cursor: pointer; display: flex; align-items: center; justify-content: center; }
  .modal-close svg { width: 15px; height: 15px; }
  .modal-search { padding: 0 20px 12px; }
  .modal-search input {
    width: 100%; padding: 10px 14px; border-radius: 11px; border: 1px solid rgba(0,0,0,0.1);
    background: white; font: inherit; font-size: 13.5px; outline: none;
  }
  .modal-actions { padding: 0 20px 10px; display: flex; gap: 8px; }
  .modal-actions button {
    font-size: 11.5px; font-weight: 600; padding: 5px 11px; border-radius: 999px;
    border: 1px solid rgba(0,0,0,0.1); background: white; cursor: pointer; color: var(--ink-soft);
  }
  .modal-list { overflow-y: auto; padding: 4px 20px 10px; flex: 1; }
  .modal-group-label { font-size: 11px; font-weight: 700; color: var(--ink-mute); text-transform: uppercase; letter-spacing: 0.04em; margin: 12px 0 6px; }
  .modal-group-label:first-child { margin-top: 4px; }
  .emp-row { display: flex; align-items: center; gap: 10px; padding: 8px 6px; border-radius: 10px; cursor: pointer; }
  .emp-row:hover { background: rgba(0,0,0,0.04); }
  .emp-checkbox {
    width: 19px; height: 19px; border-radius: 6px; border: 1.5px solid rgba(0,0,0,0.2);
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  }
  .emp-checkbox.checked { background: var(--accent); border-color: var(--accent); }
  .emp-checkbox svg { width: 12px; height: 12px; color: white; display: none; }
  .emp-checkbox.checked svg { display: block; }
  .emp-code { font-size: 13.5px; font-weight: 500; }
  .modal-footer { padding: 14px 20px 18px; }
  .modal-footer button {
    width: 100%; padding: 12px; border: none; border-radius: 12px;
    background: linear-gradient(135deg, var(--accent), #ffb454); color: white;
    font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
  }

  .page-section { display: block; }

  .team-list { display: flex; flex-direction: column; gap: 6px; }
  .team-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 14px; border-radius: 12px; cursor: pointer; font-size: 14px; font-weight: 500;
    color: var(--ink-soft);
  }
  .team-row:hover { background: rgba(255,255,255,0.5); }
  .team-row.active { background: var(--glass-bg-strong); color: var(--accent); font-weight: 600; box-shadow: 0 3px 12px rgba(224,138,31,0.12); }
  .team-count { font-size: 11.5px; color: var(--ink-mute); font-weight: 500; }
  .team-row.active .team-count { color: var(--accent); opacity: 0.7; }

  .emp-table { display: flex; flex-direction: column; gap: 4px; }
  .emp-table-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 14px; border-radius: 11px; background: rgba(255,255,255,0.45);
  }
  .emp-code-big { font-size: 14px; font-weight: 600; }
  .row-remove {
    width: 28px; height: 28px; border-radius: 8px; border: none;
    background: rgba(214,69,80,0.12); color: var(--red); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
  }
  .row-remove svg { width: 14px; height: 14px; }

  .queue-filter-row { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
  .chip-num { opacity: 0.65; margin-left: 3px; }

  .token-result { margin-bottom: 18px; padding: 14px 16px; border-radius: 14px; background: rgba(255,203,77,0.15); border: 1px solid rgba(224,138,31,0.25); }
  .token-warning { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; color: #9a6414; margin-bottom: 10px; }
  .token-warning svg { width: 15px; height: 15px; flex-shrink: 0; }
  .token-value { font-family: 'Inter', monospace; font-size: 13px; background: white; padding: 10px 14px; border-radius: 10px; word-break: break-all; }

  .device-list { display: flex; flex-direction: column; gap: 10px; }
  .device-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; background: rgba(255,255,255,0.45); }
  .device-icon { width: 34px; height: 34px; border-radius: 10px; background: rgba(224,138,31,0.12); color: var(--accent); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
  .device-icon svg { width: 17px; height: 17px; }
  .device-info { flex: 1; min-width: 0; }
  .device-name { font-size: 13.5px; font-weight: 600; }
  .device-meta { font-size: 11.5px; color: var(--ink-mute); margin-top: 2px; }
  .revoke-btn { font-size: 12px; font-weight: 600; padding: 7px 13px; border-radius: 999px; border: 1px solid rgba(214,69,80,0.3); background: transparent; color: var(--red); cursor: pointer; }
  .revoke-btn:disabled { opacity: 0.35; cursor: not-allowed; }

  @media (max-width: 860px) {
    .content-grid { grid-template-columns: 1fr; }
  }
  @media (max-width: 720px) {
    .app { flex-direction: column; }
    .sidebar { display: none; }
    .main { padding: 18px 16px 40px; }
  }  .login-screen {
    position: fixed; inset: 0; z-index: 100;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(150deg, #FFFDF9 0%, #FFF6E4 45%, #FFE9CC 100%);
  }
  .login-card { width: 100%; max-width: 380px; padding: 36px 32px; text-align: center; }
  .login-icon {
    width: 56px; height: 56px; border-radius: 16px; margin: 0 auto 18px;
    background: linear-gradient(135deg, var(--accent), #ffb454);
    display: flex; align-items: center; justify-content: center;
  }
  .login-title { font-family: 'Outfit', sans-serif; font-size: 20px; font-weight: 600; margin: 0 0 4px; }
  .login-sub { font-size: 13px; color: var(--ink-mute); margin: 0 0 26px; }
  .login-field { text-align: left; margin-bottom: 14px; }
  .login-field label { font-size: 12px; font-weight: 600; color: var(--ink-soft); display: block; margin-bottom: 6px; }
.form-error {
  background: rgba(214,69,80,0.1); border: 1px solid rgba(214,69,80,0.25);
  color: #a3313a; font-size: 12.5px; font-weight: 500;
  padding: 10px 14px; border-radius: 12px; margin: 10px 0;
}
.empty-hint {
  font-size: 12.5px; color: var(--ink-mute); padding: 10px 4px;
}
.dept-card-empty {
  grid-column: 1 / -1; text-align: center; padding: 16px; font-size: 12.5px; color: var(--ink-mute);
}
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }
