  :root {
    --bg: #0c0e13;
    --surface: #14161d;
    --surface-2: #1a1d27;
    --surface-3: #222632;
    --border: #2a2e3d;
    --border-hover: #3d4259;
    --text: #e4e6ef;
    --text-muted: #8b8fa6;
    --text-dim: #5c6078;
    --accent: #6c8aff;
    --accent-dim: rgba(108,138,255,0.12);
    --accent-glow: rgba(108,138,255,0.25);
    --green: #5ce0a0;
    --green-dim: rgba(92,224,160,0.08);
    --green-solid: rgba(92,224,160,0.15);
    --radius: 10px;
    --radius-sm: 6px;
    --overlay-bg: rgba(0,0,0,0.55);
    --panel-shadow: rgba(0,0,0,0.4);
    --bg-glow: rgba(108,138,255,0.04);
  }

  /* ── Svijetla tema ── */
  html.light {
    --bg: #f4f5f7;
    --surface: #ffffff;
    --surface-2: #f0f1f4;
    --surface-3: #e6e8ed;
    --border: #d4d7e0;
    --border-hover: #b8bcc9;
    --text: #1a1d27;
    --text-muted: #5c6078;
    --text-dim: #8b8fa6;
    --accent: #4b6fe6;
    --accent-dim: rgba(75,111,230,0.10);
    --accent-glow: rgba(75,111,230,0.18);
    --green: #2eb872;
    --green-dim: rgba(46,184,114,0.08);
    --green-solid: rgba(46,184,114,0.14);
    --overlay-bg: rgba(0,0,0,0.25);
    --panel-shadow: rgba(0,0,0,0.12);
    --bg-glow: rgba(75,111,230,0.03);
  }

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

  body {
    font-family: 'DM Sans', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
  }

  body::before {
    content: '';
    position: fixed;
    top: -40%; left: -20%;
    width: 80%; height: 80%;
    background: radial-gradient(ellipse, var(--bg-glow) 0%, transparent 70%);
    pointer-events: none; z-index: 0;
  }

  .app { position: relative; z-index: 1; max-width: 100%; padding: 24px 32px 48px; }

  /* ── Zaglavlje ── */
  .header {
    display: flex; align-items: center; justify-content: space-between;
    gap: 16px; margin-bottom: 28px; flex-wrap: wrap;
  }
  .header-left { display: flex; align-items: center; gap: 14px; }
  .logo {
    width: 42px; height: 42px;
    background: linear-gradient(135deg, var(--accent), #a78bfa);
    border-radius: var(--radius);
    display: grid; place-items: center;
    font-weight: 700; font-size: 16px; color: #fff;
    box-shadow: 0 4px 20px var(--accent-glow);
  }
  .header h1 {
    font-size: 22px; font-weight: 700; letter-spacing: -0.5px;
    background: linear-gradient(135deg, var(--text) 40%, var(--accent));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  }
  .header-meta { font-size: 13px; color: var(--text-muted); }
  .header-meta span { color: var(--accent); font-weight: 600; }

  /* ── Zona za učitavanje ── */
  .upload-zone {
    border: 2px dashed var(--border); border-radius: var(--radius);
    padding: 48px 32px; text-align: center; cursor: pointer;
    transition: all 0.3s ease; background: var(--surface);
    position: relative; overflow: hidden;
  }
  .upload-zone::before {
    content: ''; position: absolute; inset: 0;
    background: radial-gradient(circle at 50% 50%, var(--accent-dim), transparent 70%);
    opacity: 0; transition: opacity 0.3s;
  }
  .upload-zone:hover, .upload-zone.dragover { border-color: var(--accent); background: var(--surface-2); }
  .upload-zone:hover::before, .upload-zone.dragover::before { opacity: 1; }
  .upload-icon {
    width: 56px; height: 56px; margin: 0 auto 16px;
    background: var(--accent-dim); border-radius: 50%;
    display: grid; place-items: center; position: relative;
  }
  .upload-icon svg { width: 26px; height: 26px; color: var(--accent); }
  .upload-zone h2 { font-size: 17px; font-weight: 600; margin-bottom: 6px; position: relative; }
  .upload-zone p { font-size: 13px; color: var(--text-muted); position: relative; }
  .upload-zone input { display: none; }

  /* ── Informacijska traka ── */
  .info-bar {
    display: flex; align-items: center; justify-content: space-between;
    gap: 16px; margin-bottom: 16px; flex-wrap: wrap;
  }
  .info-left { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
  .badge {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 5px 12px; background: var(--surface-2);
    border: 1px solid var(--border); border-radius: 20px;
    font-size: 12px; font-weight: 500; color: var(--text-muted);
  }
  .badge .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px var(--green); }
  .badge strong { color: var(--text); 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-sm); padding: 6px 12px; transition: border-color 0.2s;
  }
  .search-box:focus-within { border-color: var(--accent); }
  .search-box svg { width: 16px; height: 16px; color: var(--text-dim); flex-shrink: 0; }
  .search-box input {
    background: none; border: none; outline: none;
    color: var(--text); font-family: inherit; font-size: 13px; width: 200px;
  }
  .search-box input::placeholder { color: var(--text-dim); }

  /* ── Tablica ── */
  .table-wrap { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
  .table-scroll { overflow-x: auto; }
  table { width: 100%; border-collapse: collapse; font-size: 13px; white-space: nowrap; }

  thead { position: sticky; top: 0; z-index: 10; background: var(--surface-2); }
  thead th {
    padding: 12px 14px; text-align: left; font-weight: 600; font-size: 11px;
    text-transform: uppercase; letter-spacing: 0.6px; color: var(--text-muted);
    border-bottom: 1px solid var(--border); user-select: none; cursor: pointer; transition: color 0.2s;
  }
  thead th:hover { color: var(--accent); }
  thead th .sort-arrow { font-size: 10px; margin-left: 4px; opacity: 0.4; }
  thead th.sorted .sort-arrow { opacity: 1; color: var(--accent); }
  thead th.no-sort { cursor: default; }
  thead th.no-sort:hover { color: var(--text-muted); }

  tbody tr {
    transition: background 0.15s; border-bottom: 1px solid var(--border);
    cursor: pointer;
  }
  tbody tr:last-child { border-bottom: none; }
  tbody tr:hover { background: var(--surface-2); }

  /* ── Završeni redovi ── */
  tbody tr.completed { background: var(--green-dim); }
  tbody tr.completed:hover { background: var(--green-solid); }
  tbody tr.completed td { color: var(--text-muted); }
  tbody tr.completed td.row-num { color: var(--green); }
  tbody tr.completed td.status-col .status-dot { background: var(--green); box-shadow: 0 0 6px var(--green); }

  tbody td {
    padding: 10px 14px; color: var(--text);
    font-family: 'JetBrains Mono', monospace; font-size: 12px;
  }
  tbody td .cell-text { overflow: hidden; text-overflow: ellipsis; max-width: 220px; display: block; }

  td.row-num {
    font-family: 'DM Sans', sans-serif; color: var(--text-dim);
    font-size: 11px; font-weight: 500; text-align: center; width: 42px; min-width: 42px;
  }

  /* ── Status stupac ── */
  td.status-col { width: 32px; min-width: 32px; text-align: center; }
  .status-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--border-hover); display: inline-block;
    transition: all 0.2s;
  }

  /* ── Strelica za otvaranje ── */
  td.arrow-col {
    width: 32px; min-width: 32px; text-align: center;
    color: var(--text-dim); font-size: 14px;
  }

  /* ── Prazno stanje ── */
  .empty-state { padding: 64px 32px; text-align: center; color: var(--text-dim); font-size: 14px; }

  /* ═══════════════════════════════════════
     DETALJNI PRIKAZ — bočna ploča
     ═══════════════════════════════════════ */
  .overlay {
    position: fixed; inset: 0; background: var(--overlay-bg);
    z-index: 100; opacity: 0; pointer-events: none;
    transition: opacity 0.25s ease;
    backdrop-filter: blur(4px);
  }
  .overlay.open { opacity: 1; pointer-events: all; }

  .detail-panel {
    position: fixed; top: 0; right: 0; bottom: 0;
    width: min(560px, 92vw);
    background: var(--surface);
    border-left: 1px solid var(--border);
    z-index: 101;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex; flex-direction: column;
    box-shadow: -8px 0 40px var(--panel-shadow);
  }
  .detail-panel.open { transform: translateX(0); }

  /* Zaglavlje ploče */
  .detail-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 20px 24px; border-bottom: 1px solid var(--border);
    flex-shrink: 0;
  }
  .detail-header-left { display: flex; align-items: center; gap: 12px; }
  .detail-header h2 { font-size: 16px; font-weight: 700; }
  .detail-badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 10px; border-radius: 12px;
    font-size: 11px; font-weight: 600;
  }
  .detail-badge.pending { background: var(--surface-3); color: var(--text-muted); }
  .detail-badge.done { background: rgba(92,224,160,0.15); color: var(--green); }

  .close-btn {
    width: 36px; height: 36px; border: 1px solid var(--border);
    border-radius: var(--radius-sm); background: var(--surface-2);
    cursor: pointer; display: grid; place-items: center;
    color: var(--text-muted); transition: all 0.15s;
  }
  .close-btn:hover { border-color: var(--border-hover); color: var(--text); background: var(--surface-3); }
  .close-btn svg { width: 18px; height: 18px; }

  /* Sadržaj ploče */
  .detail-body {
    flex: 1; overflow-y: auto; padding: 8px 0;
  }

  .detail-field {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 24px; gap: 12px;
    border-bottom: 1px solid rgba(42,46,61,0.5);
    transition: background 0.12s;
  }
  .detail-field:hover { background: var(--surface-2); }
  .detail-field:last-child { border-bottom: none; }

  .field-label {
    font-size: 11px; font-weight: 600; text-transform: uppercase;
    letter-spacing: 0.5px; color: var(--text-dim);
    min-width: 130px; flex-shrink: 0;
  }
  .field-value-wrap { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; justify-content: flex-end; }
  .field-value {
    font-family: 'JetBrains Mono', monospace; font-size: 13px;
    color: var(--text); overflow: hidden; text-overflow: ellipsis;
    white-space: nowrap;
  }
  .field-value.empty { color: var(--text-dim); font-style: italic; }

  /* Gumb za kopiranje u detaljima */
  .detail-copy-btn {
    flex-shrink: 0; width: 30px; height: 30px;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: var(--surface-2); cursor: pointer;
    display: grid; place-items: center;
    color: var(--text-dim); transition: all 0.15s;
  }
  .detail-copy-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }
  .detail-copy-btn.copied { border-color: var(--green); color: var(--green); background: rgba(92,224,160,0.1); }
  .detail-copy-btn svg { width: 14px; height: 14px; }

  /* Podnožje ploče */
  .detail-footer {
    padding: 16px 24px; border-top: 1px solid var(--border);
    display: flex; gap: 10px; flex-shrink: 0;
  }
  .btn {
    padding: 10px 20px; border-radius: var(--radius-sm);
    font-family: inherit; font-size: 13px; font-weight: 600;
    cursor: pointer; transition: all 0.15s; border: none;
    display: inline-flex; align-items: center; gap: 8px;
  }
  .btn-complete {
    background: var(--green); color: var(--bg);
  }
  .btn-complete:hover { background: #4dd893; }
  .btn-complete.is-done {
    background: var(--surface-3); color: var(--text-muted);
    border: 1px solid var(--border);
  }
  .btn-complete.is-done:hover { border-color: var(--border-hover); color: var(--text); }
  .btn-close-detail {
    background: var(--surface-3); color: var(--text-muted);
    border: 1px solid var(--border);
  }
  .btn-close-detail:hover { border-color: var(--border-hover); color: var(--text); }

  .btn svg { width: 16px; height: 16px; }

  /* ── Obavijest ── */
  .toast {
    position: fixed; bottom: 28px; left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--surface-3); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 10px 20px;
    font-size: 13px; font-weight: 500; color: var(--green);
    opacity: 0; pointer-events: none; transition: all 0.3s ease;
    z-index: 999; box-shadow: 0 8px 32px var(--panel-shadow);
  }
  .toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

  /* ── Traka za pomicanje ── */
  ::-webkit-scrollbar { height: 8px; width: 8px; }
  ::-webkit-scrollbar-track { background: var(--surface); }
  ::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
  ::-webkit-scrollbar-thumb:hover { background: var(--border-hover); }

  @media (max-width: 768px) {
    .app { padding: 16px; }
    .header h1 { font-size: 18px; }
    .search-box input { width: 140px; }
    .detail-panel { width: 100vw; }
    .field-label { min-width: 100px; }
  }

  /* ── Prekidač za temu ── */
  .theme-toggle {
    width: 40px; height: 40px;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: var(--surface-2); cursor: pointer;
    display: grid; place-items: center;
    color: var(--text-muted); transition: all 0.2s;
  }
  .theme-toggle:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }
  .theme-toggle svg { width: 20px; height: 20px; }
  .theme-toggle .icon-sun { display: none; }
  .theme-toggle .icon-moon { display: block; }
  html.light .theme-toggle .icon-sun { display: block; }
  html.light .theme-toggle .icon-moon { display: none; }

  /* Svijetla tema — korekcije za hardkodirane boje */
  html.light .logo { color: #fff; }
  html.light .header h1 {
    background: linear-gradient(135deg, var(--text) 40%, var(--accent));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  }
  html.light tbody tr.completed .cell-text {
    text-decoration-color: rgba(46,184,114,0.45);
  }
  html.light .detail-badge.done { background: rgba(46,184,114,0.12); }
  html.light .detail-copy-btn.copied { background: rgba(46,184,114,0.08); }
  html.light .btn-complete { color: #fff; }
  html.light .btn-complete.is-done { color: var(--text-muted); }

  @keyframes fadeUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
  }
  .fade-in { animation: fadeUp 0.4s ease forwards; }
