:root{
  --bg: #10131A;
  --surface: #161B24;
  --surface-2: #1D2330;
  --border: #262C39;
  --text: #E6E9EF;
  --muted: #8A93A6;
  --accent: #F2B84B;
  --accent-dim: #7A5F26;
  --accent2: #4FD1C5;
  --danger: #E8697D;
  --danger-dim: #4A2530;
  --radius: 10px;
}
*{box-sizing:border-box;}
body{margin:0;}
html,body{
  background: var(--bg);
  color: var(--text);
  font-family: 'IBM Plex Sans', sans-serif;
  min-height: 100vh;
}
h1,h2,h3{ font-family:'Space Grotesk', sans-serif; margin:0; letter-spacing:-0.01em;}
.mono{ font-family:'IBM Plex Mono', monospace; }
.muted{ color: var(--muted); }
button{ font-family: inherit; cursor:pointer; }
input, select{ font-family: inherit; }

#app{ min-height:100vh; display:flex; flex-direction:column; }

/* ---------- Login screen ---------- */
.login-wrap{
  flex:1; display:flex; align-items:center; justify-content:center;
  padding: 24px;
  background:
    radial-gradient(circle at 20% 15%, rgba(242,184,75,0.07), transparent 40%),
    radial-gradient(circle at 80% 85%, rgba(79,209,197,0.07), transparent 40%);
}
.keycard{
  width: 380px;
  max-width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 32px;
  position: relative;
  overflow: hidden;
}
.keycard::before{
  content:"";
  position:absolute; top:0; left:0; right:0; height:4px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
}
.keycard-eyebrow{
  font-family:'IBM Plex Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 6px;
}
.keycard-eyebrow.user-flavor{ color: var(--accent2); }
.keycard h1{ font-size: 24px; margin-bottom: 4px;}
.keycard p.sub{ color: var(--muted); font-size: 13.5px; margin: 0 0 24px; }

.field{ margin-bottom: 16px; }
.field label{ display:block; font-size: 12px; color: var(--muted); margin-bottom: 6px; letter-spacing:0.02em;}
.field input, .field select{
  width:100%; padding: 11px 12px; background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); font-size: 14px; outline: none; transition: border-color .15s;
}
.field input:focus, .field select:focus{ border-color: var(--accent); }

.btn-primary{
  width: 100%; padding: 12px 0; border: none; border-radius: 8px;
  background: var(--accent); color: #1a1206; font-weight: 700; font-size: 14px;
  letter-spacing: 0.01em; margin-top: 4px; transition: opacity .15s;
}
.btn-primary.user-flavor{ background: var(--accent2); color: #08211f; }
.btn-primary:hover{ opacity: .9; }

.login-error{
  background: var(--danger-dim); color: #F5B8C2; border: 1px solid #5a2a37;
  padding: 10px 12px; border-radius: 8px; font-size: 13px; margin-bottom: 16px; display:none;
}
.login-hint{ margin-top: 18px; font-size: 12px; color: var(--muted); line-height:1.6; border-top:1px solid var(--border); padding-top: 14px;}
.login-hint .mono{ color: var(--accent2); }

.switch-link{
  display:block; text-align:center; margin-top: 18px; font-size: 12.5px; color: var(--muted);
  text-decoration:none;
}
.switch-link a{ color: var(--accent2); text-decoration:none; }
.switch-link a:hover{ text-decoration:underline; }

/* ---------- Dashboard shell ---------- */
.topbar{
  display:flex; align-items:center; justify-content:space-between;
  padding: 16px 28px; border-bottom: 1px solid var(--border); background: var(--surface);
}
.brand{ display:flex; align-items:center; gap:10px; }
.brand-mark{
  width:30px; height:30px; border-radius:7px; background: linear-gradient(135deg, var(--accent), var(--accent2));
}
.brand-logo{
  width:34px !important; height:34px !important; border-radius:7px; object-fit:contain; background: var(--surface-2);
}
.login-logo{
  height: 44px !important; width: auto !important; max-width: 220px; margin-bottom: 18px; display:block; object-fit: contain;
}
.brand h2{ font-size: 16px; }
.who{ display:flex; align-items:center; gap:12px; }
.badge{
  font-family:'IBM Plex Mono', monospace; font-size: 11px; padding: 4px 10px; border-radius: 999px;
  border: 1px solid var(--border); color: var(--muted); text-transform:uppercase; letter-spacing:0.08em;
}
.badge.admin{ color: var(--accent); border-color: var(--accent-dim); }
.badge.user{ color: var(--accent2); border-color: #234a47; }
.logout-btn{
  background: transparent; border: 1px solid var(--border); color: var(--text);
  padding: 8px 14px; border-radius: 7px; font-size: 13px; font-weight:500;
}
.logout-btn:hover{ border-color: var(--danger); color: var(--danger); }

main{ flex:1; padding: 28px; max-width: 1080px; width:100%; margin: 0 auto; }

.panel{
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px; margin-bottom: 22px;
}
.panel-head{ display:flex; align-items:center; justify-content:space-between; margin-bottom: 16px; flex-wrap:wrap; gap:10px;}
.panel-head h3{ font-size: 15px; }
.panel-head .eyebrow{
  font-family:'IBM Plex Mono', monospace; font-size: 10.5px; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.12em; display:block; margin-bottom:4px;
}

.tabs{ display:flex; gap: 6px; margin-bottom: 22px; border-bottom: 1px solid var(--border); }
.tab{
  background:none; border:none; color: var(--muted); padding: 10px 4px; margin-right: 20px;
  font-size: 14px; font-weight: 600; border-bottom: 2px solid transparent; margin-bottom:-1px;
}
.tab.active{ color: var(--text); border-bottom-color: var(--accent); }

.inline-form{ display:flex; gap:10px; flex-wrap:wrap; align-items:flex-end; }
.inline-form .field{ margin-bottom:0; flex:1; min-width:140px; }
.btn-add{
  padding: 11px 18px; background: var(--accent2); color:#08211f; border:none; border-radius:8px;
  font-weight:700; font-size:13.5px; white-space:nowrap; height:42px;
}
.btn-add:hover{ opacity:.9; }
.btn-add:disabled{ opacity:.4; cursor:not-allowed; }

table{ width:100%; border-collapse: collapse; margin-top: 4px;}
th{
  text-align:left; font-size: 11px; text-transform: uppercase; letter-spacing:0.06em; color: var(--muted);
  padding: 10px 10px; border-bottom: 1px solid var(--border); font-weight:600;
}
td{ padding: 12px 10px; border-bottom: 1px solid var(--border); font-size: 13.5px; vertical-align: middle; }
tr:last-child td{ border-bottom:none; }
.row-actions{ display:flex; gap:8px; }
.icon-btn{
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  padding: 6px 11px; border-radius:6px; font-size:12.5px; font-weight:500;
}
.icon-btn:hover{ border-color: var(--accent2); color: var(--accent2); }
.icon-btn.danger:hover{ border-color: var(--danger); color: var(--danger); }
.icon-btn:disabled{ opacity:.35; cursor:not-allowed; }

.empty{ text-align:center; padding: 34px 10px; color: var(--muted); font-size: 13.5px; }

/* upload zone */
.drop{
  border: 1.5px dashed var(--border); border-radius: 10px; padding: 32px; text-align:center;
  background: var(--surface-2); transition: border-color .15s;
}
.drop.drag{ border-color: var(--accent2); }
.drop input[type=file]{ display:none; }
.drop .pick-btn{
  display:inline-block; margin-top: 10px; padding: 10px 18px; border-radius:8px;
  background: var(--accent2); color:#08211f; font-weight:700; font-size: 13.5px;
}

/* multi-file pending list */
.file-list{ margin-top: 16px; display:flex; flex-direction:column; gap: 8px; }
.file-row{
  display:flex; align-items:center; justify-content:space-between; gap: 10px;
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px;
}
.file-row .file-meta{ min-width:0; }
.file-row .file-meta strong{ display:block; font-size: 13.5px; font-weight:500; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.file-row .file-meta span{ font-size: 11.5px; color: var(--muted); }
.file-row .remove-btn{
  background: none; border: 1px solid var(--border); color: var(--muted);
  width: 26px; height:26px; border-radius: 6px; font-size: 14px; flex-shrink:0; line-height:1;
}
.file-row .remove-btn:hover{ border-color: var(--danger); color: var(--danger); }
.submit-row{ display:flex; justify-content:flex-end; margin-top: 16px; }

.toast{
  position: fixed; bottom: 24px; right: 24px; background: var(--surface); border:1px solid var(--accent2);
  color: var(--text); padding: 12px 18px; border-radius: 8px; font-size: 13.5px; opacity:0;
  transform: translateY(8px); transition: all .25s ease; pointer-events:none; z-index: 50;
}
.toast.show{ opacity:1; transform: translateY(0); }

/* modals */
.modal-overlay{
  position: fixed; inset:0; background: rgba(8,9,13,0.72); display:none; align-items:center; justify-content:center; z-index: 40; padding: 20px;
}
.modal-overlay.show{ display:flex; }
.modal{
  background: var(--surface); border:1px solid var(--border); border-radius: 12px; padding: 24px; width: 360px; max-width:100%;
}
.modal h3{ margin-bottom: 18px; font-size: 15px;}
.modal-actions{ display:flex; gap:10px; margin-top: 20px; }
.modal-actions .icon-btn, .modal-actions .btn-add{ flex:1; text-align:center; }

.success-icon{
  width: 46px; height:46px; border-radius: 50%; background: rgba(79,209,197,0.14); color: var(--accent2);
  display:flex; align-items:center; justify-content:center; font-size: 22px; margin-bottom: 14px;
}
.modal p.success-msg{ font-size: 13.5px; color: var(--text); line-height:1.6; margin: 0 0 4px; }

.hidden{ display:none !important; }

@media (max-width: 640px){
  main{ padding: 18px; }
  table, thead, tbody, th, td, tr{ display:block; }
  thead{ display:none; }
  tr{ border-bottom: 1px solid var(--border); padding: 10px 0; }
  td{ border:none; padding: 4px 0; display:flex; justify-content:space-between; gap: 10px;}
  td::before{ content: attr(data-label); color: var(--muted); font-size: 11px; text-transform:uppercase; }
}
