:root {
    --bg: #f5f4f0;
    --surface: #ffffff;
    --surface-2: #f0efe9;
    --border: #e2e0d8;
    --border-strong: #c8c5b8;
    --text-primary: #1a1916;
    --text-secondary: #6b6860;
    --text-tertiary: #9e9b93;
    --accent: #1d6f42;
    --accent-light: #e8f4ed;
    --accent-hover: #165c36;
    --warning: #92400e;
    --warning-bg: #fef3c7;
    --info: #1e40af;
    --info-bg: #eff6ff;
    --danger: #991b1b;
    --danger-bg: #fef2f2;
    --radius: 8px;
    --radius-lg: 12px;
    --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
  }

  * { box-sizing: border-box; margin: 0; padding: 0; }

  body {
    font-family: 'DM Sans', sans-serif;
    background: var(--bg);
    color: var(--text-primary);
    min-height: 100vh;
    font-size: 14px;
    line-height: 1.5;
  }

  /* NAV */
  nav {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
  }

  .nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .nav-logo {
    width: 28px;
    height: 28px;
    background: var(--accent);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 13px;
    font-weight: 600;
  }

  .nav-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
  }

  .nav-subtitle {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-left: 2px;
  }

  .nav-tabs {
    display: flex;
    gap: 4px;
  }

  .nav-tab {
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    transition: all 0.15s;
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: 'DM Sans', sans-serif;
  }

  .nav-tab:hover { background: var(--surface-2); color: var(--text-primary); }
  .nav-tab.active { background: var(--accent-light); color: var(--accent); }

  .nav-right {
    display: flex;
    align-items: center;
    gap: 12px;
  }

  .avatar {
    width: 30px;
    height: 30px;
    background: var(--accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
    font-weight: 600;
  }

  /* SCREENS */
  .screen { display: none; }
  .screen.active { display: block; }

  /* MAIN LAYOUT */
  main { max-width: 860px; margin: 0 auto; padding: 32px 24px; }

  /* PAGE HEADER */
  .page-header {
    margin-bottom: 24px;
  }

  .page-header h1 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
  }

  .page-header p {
    font-size: 13px;
    color: var(--text-secondary);
  }

  /* CARD */
  .card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
  }

  .card-header {
    padding: 18px 24px 14px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .card-title {
    font-size: 14px;
    font-weight: 600;
  }

  .card-body { padding: 20px 24px; }

  /* SECTION LABEL */
  .section-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
  }

  /* FORM */
  .form-row {
    display: grid;
    gap: 14px;
    margin-bottom: 14px;
  }

  .form-row.col-2 { grid-template-columns: 1fr 1fr; }
  .form-row.col-3 { grid-template-columns: 1fr 1fr 1fr; }
  .form-row.col-1 { grid-template-columns: 1fr; }

  .field label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 5px;
  }

  .field .required { color: var(--danger); margin-left: 2px; }

  input[type="text"],
  input[type="date"],
  input[type="number"],
  input[type="email"],
  select,
  textarea {
    width: 100%;
    padding: 8px 11px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    font-size: 13px;
    font-family: 'DM Sans', sans-serif;
    color: var(--text-primary);
    background: var(--surface);
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    appearance: none;
    -webkit-appearance: none;
  }

  input:focus, select:focus, textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(29, 111, 66, 0.1);
  }

  textarea { resize: vertical; min-height: 72px; }

  select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b6860' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
  }

  /* UPLOAD ZONE */
  .upload-zone {
    border: 1.5px dashed var(--border-strong);
    border-radius: var(--radius);
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.15s;
    background: var(--surface-2);
    position: relative;
  }

  .upload-zone:hover {
    border-color: var(--accent);
    background: var(--accent-light);
  }

  .upload-zone input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
  }

  .upload-icon {
    font-size: 24px;
    margin-bottom: 8px;
    display: block;
  }

  .upload-text {
    font-size: 13px;
    color: var(--text-secondary);
  }

  .upload-text span {
    color: var(--accent);
    font-weight: 500;
    text-decoration: underline;
    text-underline-offset: 2px;
  }

  .upload-hint {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-top: 4px;
  }

  .file-attached {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--accent-light);
    border-radius: var(--radius);
    margin-top: 10px;
    font-size: 12px;
    color: var(--accent);
  }

  /* CHECKBOX */
  .check-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
  }

  .check-row input[type="checkbox"] {
    width: 15px;
    height: 15px;
    accent-color: var(--accent);
    cursor: pointer;
  }

  /* REQUEST ID BADGE */
  .req-id-badge {
    font-family: 'DM Mono', monospace;
    font-size: 11px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    padding: 4px 10px;
    border-radius: 20px;
    color: var(--text-secondary);
  }

  /* BUTTONS */
  .btn {
    padding: 8px 16px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    font-family: 'DM Sans', sans-serif;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
  }

  .btn-ghost {
    background: transparent;
    border-color: var(--border-strong);
    color: var(--text-secondary);
  }

  .btn-ghost:hover { background: var(--surface-2); color: var(--text-primary); }

  .btn-primary {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
  }

  .btn-primary:hover { background: var(--accent-hover); }

  .btn-sm {
    padding: 5px 10px;
    font-size: 12px;
  }

  /* FORM FOOTER */
  .form-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    margin-top: 4px;
  }

  /* SUCCESS TOAST */
  .toast {
    display: none;
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--accent);
    color: white;
    padding: 12px 18px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    box-shadow: var(--shadow-md);
    z-index: 999;
    animation: slideUp 0.3s ease;
  }

  @keyframes slideUp {
    from { transform: translateY(12px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
  }

  /* DASHBOARD */
  .stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 20px;
  }

  .stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 14px 16px;
    box-shadow: var(--shadow);
  }

  .stat-num {
    font-size: 26px;
    font-weight: 600;
    font-family: 'DM Mono', monospace;
    line-height: 1.1;
    margin-bottom: 4px;
  }

  .stat-label {
    font-size: 12px;
    color: var(--text-secondary);
  }

  .c-warning { color: var(--warning); }
  .c-success { color: var(--accent); }
  .c-info { color: var(--info); }

  /* TABLE */
  .table-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
  }

  .table-toolbar h2 { font-size: 14px; font-weight: 600; }

  .search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 6px 10px;
    width: 200px;
  }

  .search-box input {
    border: none;
    background: transparent;
    font-size: 13px;
    outline: none;
    width: 100%;
    padding: 0;
    box-shadow: none;
  }

  .search-box input:focus { box-shadow: none; border: none; }

  table {
    width: 100%;
    border-collapse: collapse;
  }

  thead th {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 10px 16px;
    text-align: left;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
  }

  tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background 0.1s;
    cursor: pointer;
  }

  tbody tr:last-child { border-bottom: none; }
  tbody tr:hover { background: var(--surface-2); }

  td {
    padding: 11px 16px;
    font-size: 13px;
    vertical-align: middle;
  }

  .td-id {
    font-family: 'DM Mono', monospace;
    font-size: 12px;
    color: var(--text-secondary);
  }

  .td-desc { font-weight: 500; }
  .td-meta { color: var(--text-secondary); }
  .td-po { font-family: 'DM Mono', monospace; font-size: 12px; color: var(--accent); font-weight: 500; }

  /* BADGES */
  .badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
  }

  .badge::before {
    content: '';
    width: 5px;
    height: 5px;
    border-radius: 50%;
  }

  .badge-pending { background: var(--warning-bg); color: var(--warning); }
  .badge-pending::before { background: var(--warning); }
  .badge-raised { background: var(--accent-light); color: var(--accent); }
  .badge-raised::before { background: var(--accent); }
  .badge-amended { background: var(--info-bg); color: var(--info); }
  .badge-amended::before { background: var(--info); }
  .badge-cancelled { background: var(--danger-bg); color: var(--danger); }
  .badge-cancelled::before { background: var(--danger); }

  /* DETAIL PANEL */
  .detail-panel {
    display: none;
    position: fixed;
    top: 56px;
    right: 0;
    bottom: 0;
    width: 360px;
    background: var(--surface);
    border-left: 1px solid var(--border);
    box-shadow: -4px 0 20px rgba(0,0,0,0.08);
    z-index: 90;
    overflow-y: auto;
    padding: 20px;
    animation: slideIn 0.2s ease;
  }

  @keyframes slideIn {
    from { transform: translateX(20px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
  }

  .detail-panel.open { display: block; }

  .detail-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 18px;
  }

  .detail-title { font-size: 15px; font-weight: 600; }
  .detail-subtitle { font-size: 12px; color: var(--text-tertiary); margin-top: 2px; }

  .close-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    color: var(--text-tertiary);
    padding: 2px;
    line-height: 1;
  }

  .detail-section { margin-bottom: 18px; }
  .detail-section-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.07em;
    margin-bottom: 10px;
  }

  .detail-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
  }

  .detail-row:last-child { border-bottom: none; }
  .detail-key { font-size: 12px; color: var(--text-secondary); }
  .detail-val { font-size: 12px; font-weight: 500; text-align: right; max-width: 180px; }

  .update-section { margin-top: 16px; }

  /* URGENCY DOT */
  .urgent-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    background: #dc2626;
    border-radius: 50%;
    margin-right: 4px;
    vertical-align: middle;
  }

  .table-empty {
    padding: 40px;
    text-align: center;
    color: var(--text-tertiary);
    font-size: 13px;
  }


  /* TRACK REQUEST */
  .track-result {
    display:none;
    margin-top:12px;
    padding:14px;
    border-radius:var(--radius);
    border:1px solid var(--border);
    background:var(--surface-2);
    font-size:13px;
  }
  .track-result.found { border-color:var(--accent); background:var(--accent-light); }
  .track-result.notfound { border-color:var(--border-strong); background:var(--surface-2); }
  .track-label { font-size:11px;font-weight:600;color:var(--text-tertiary);text-transform:uppercase;letter-spacing:.05em;margin-bottom:6px; }
  .track-row { display:flex;justify-content:space-between;padding:4px 0;font-size:13px;border-bottom:1px solid var(--border); }
  .track-row:last-child { border-bottom:none; }
  .track-key { color:var(--text-secondary); }
  .track-val { font-weight:500; }

  /* RECENT REQUESTS */
  .recent-card {
    background:var(--surface);
    border:1px solid var(--border);
    border-radius:var(--radius-lg);
    box-shadow:var(--shadow);
    margin-bottom:20px;
    overflow:hidden;
  }
  .recent-header {
    padding:12px 20px;
    border-bottom:1px solid var(--border);
    display:flex;
    align-items:center;
    justify-content:space-between;
    background:var(--surface-2);
  }
  .recent-header h3 { font-size:13px;font-weight:600; }
  .recent-item {
    display:grid;
    grid-template-columns:120px 1fr 100px 80px;
    gap:10px;
    align-items:center;
    padding:10px 20px;
    border-bottom:1px solid var(--border);
    font-size:12px;
    transition:background .1s;
  }
  .recent-item:last-child { border-bottom:none; }
  .recent-item:hover { background:var(--surface-2); }
  .recent-id { font-family:'DM Mono',monospace;font-size:11px;color:var(--text-secondary); }
  .recent-desc { font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis; }
  .recent-date { color:var(--text-tertiary); }
  .recent-empty { padding:20px;text-align:center;color:var(--text-tertiary);font-size:13px; }

  /* CONFIRMATION SCREEN */
  .confirm-screen {
    display:none;
    text-align:center;
    padding:40px 24px;
  }
  .confirm-icon { font-size:48px;margin-bottom:16px; }
  .confirm-id {
    font-family:'DM Mono',monospace;
    font-size:22px;
    font-weight:600;
    color:var(--accent);
    background:var(--accent-light);
    border:1px solid var(--accent);
    border-radius:var(--radius);
    padding:10px 24px;
    display:inline-block;
    margin:12px 0 8px;
    letter-spacing:.04em;
  }
  .confirm-hint { font-size:13px;color:var(--text-secondary);margin-bottom:24px; }

  @media (max-width: 640px) {
    main { padding: 16px; }
    .form-row.col-2, .form-row.col-3 { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    nav { padding: 0 16px; }
    .nav-subtitle { display: none; }
    .detail-panel { width: 100%; }
  }