/* LockerPDF — UI kit (Open Design · high-fidelity) */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Instrument+Serif:ital@0;1&display=swap');

:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --fg: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --accent: #1d4ed8;
  --accent-hover: #1e40af;
  --accent-soft: #eff6ff;
  --accent-ring: rgb(29 78 216 / 12%);
  --success: #047857;
  --success-soft: #ecfdf5;
  --warning: #b45309;
  --warning-soft: #fffbeb;
  --danger: #b91c1c;
  --danger-soft: #fef2f2;
  --sidebar: #0f172a;
  --sidebar-fg: #94a3b8;
  --sidebar-active: #1e293b;
  --sidebar-accent: #3b82f6;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgb(15 23 42 / 6%);
  --shadow: 0 4px 24px rgb(15 23 42 / 8%);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-display: 'Instrument Serif', Georgia, serif;
  --container: 1280px;
  --sidebar-w: 256px;
  --topbar-h: 56px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; }
svg { display: block; flex-shrink: 0; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: -0.02em;
  margin: 0 0 6px;
}
p { margin: 0; color: var(--muted); }
.lead { font-size: 16px; max-width: 56ch; }

.container { max-width: var(--container); margin-inline: auto; padding-inline: clamp(16px, 4vw, 32px); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 1px 2px rgb(29 78 216 / 25%);
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--fg);
}
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { padding: 7px 12px; font-size: 12px; }
.btn-block { width: 100%; }

/* Form */
.field { margin-bottom: 18px; }
.field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 6px;
}
.field input, .field select, .field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--fg);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field input:focus, .field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

/* Auth */
.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.auth-panel-left {
  background: var(--sidebar);
  color: #fff;
  padding: clamp(32px, 6vw, 64px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.auth-panel-left h2 {
  font-size: clamp(32px, 4vw, 44px);
  color: #fff;
  max-width: 12ch;
  line-height: 1.1;
}
.auth-panel-left p { color: #94a3b8; font-size: 15px; max-width: 36ch; }
.auth-features { list-style: none; padding: 0; margin: 32px 0 0; display: grid; gap: 16px; }
.auth-features li {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  font-size: 14px;
  color: #cbd5e1;
}
.auth-features svg { width: 20px; height: 20px; color: var(--sidebar-accent); flex-shrink: 0; margin-top: 2px; }
.auth-panel-right {
  display: grid;
  place-items: center;
  padding: 32px;
  background: var(--bg);
}
.auth-card { width: min(400px, 100%); }
.auth-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
}
.auth-logo-mark {
  width: 44px; height: 44px;
  background: linear-gradient(135deg, #1d4ed8, #3b82f6);
  border-radius: 11px;
  display: grid; place-items: center;
  box-shadow: 0 8px 20px rgb(29 78 216 / 35%);
}
.auth-logo-mark svg { width: 24px; height: 24px; color: #fff; }
.auth-logo strong { font-size: 20px; display: block; color: var(--fg); font-weight: 700; }
.auth-logo span { font-size: 13px; color: var(--muted); }

/* App shell */
.app-layout { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.app-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  height: var(--topbar-h);
  padding: 0 28px;
  background: rgb(255 255 255 / 92%);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
}
.topbar-spacer { flex: 1; }
.nav-toggle,
.nav-close {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--fg);
  cursor: pointer;
}
.nav-toggle svg,
.nav-close svg { color: var(--fg); }
.topbar-brand {
  display: none;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 15px;
  color: var(--fg);
}
.topbar-menu { position: relative; }
.topbar-menu > summary { list-style: none; cursor: pointer; }
.topbar-menu > summary::-webkit-details-marker { display: none; }
.topbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 6px 6px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  transition: background 0.12s, border-color 0.12s;
}
.topbar-user:hover,
.topbar-menu[open] .topbar-user {
  background: var(--surface-2);
  border-color: var(--border);
}
.topbar-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--fg);
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.topbar-chevron {
  width: 16px;
  height: 16px;
  color: var(--muted);
  transition: transform 0.15s;
}
.topbar-menu[open] .topbar-chevron { transform: rotate(180deg); }
.topbar-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 220px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  padding: 6px;
}
.topbar-dropdown-meta {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}
.topbar-dropdown-meta strong {
  display: block;
  font-size: 13px;
  color: var(--fg);
  margin-bottom: 2px;
}
.topbar-dropdown-meta span {
  font-size: 12px;
  color: var(--muted);
  word-break: break-all;
}
.topbar-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--fg);
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s;
}
.topbar-dropdown-item svg { width: 16px; height: 16px; color: var(--muted); flex-shrink: 0; }
.topbar-dropdown-item:hover { background: var(--surface-2); }
.topbar-dropdown-item-danger { color: var(--danger); }
.topbar-dropdown-item-danger svg { color: var(--danger); }
.topbar-dropdown-form { margin: 0; }
.sidebar {
  background: var(--sidebar);
  color: var(--sidebar-fg);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 300;
}
.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px 20px;
  margin-bottom: 8px;
  border-bottom: 1px solid rgb(255 255 255 / 8%);
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  flex: 1;
  min-width: 0;
}
.nav-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 250;
  border: none;
  padding: 0;
  background: rgb(15 23 42 / 45%);
  cursor: pointer;
}
.sidebar-brand img { flex-shrink: 0; }
.sidebar-brand svg { width: 28px; height: 28px; }
.sidebar-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--sidebar-fg);
  transition: background 0.12s, color 0.12s;
}
.sidebar-nav a svg { width: 18px; height: 18px; opacity: 0.85; }
.sidebar-nav a.is-active, .sidebar-nav a:hover {
  background: var(--sidebar-active);
  color: #fff;
}
.sidebar-nav a.is-active { box-shadow: inset 3px 0 0 var(--sidebar-accent); }
.sidebar-foot {
  padding: 12px 10px 0;
  border-top: 1px solid rgb(255 255 255 / 8%);
  font-size: 12px;
  color: #64748b;
}
.main { padding: 24px 28px 40px; min-width: 0; flex: 1; }
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}
.page-header h1 { font-size: clamp(26px, 3vw, 32px); }
.avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  display: grid; place-items: center;
  font-weight: 700;
  font-size: 12px;
}

/* Stats */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}
.stat-card .icon-wrap {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: grid; place-items: center;
  margin-bottom: 12px;
}
.stat-card .icon-wrap svg { width: 18px; height: 18px; }
.stat-card .value { font-size: 28px; font-weight: 700; color: var(--fg); line-height: 1; letter-spacing: -0.03em; }
.stat-card .label { font-size: 12px; color: var(--muted); margin-top: 4px; }
.stat-blue .icon-wrap { background: var(--accent-soft); color: var(--accent); }
.stat-green .icon-wrap { background: var(--success-soft); color: var(--success); }
.stat-amber .icon-wrap { background: var(--warning-soft); color: var(--warning); }
.stat-slate .icon-wrap { background: var(--surface-2); color: var(--muted); }

/* Card & table */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.card-head strong { font-size: 14px; font-weight: 600; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 12px 20px; text-align: left; border-bottom: 1px solid var(--border); }
th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 600;
  background: var(--surface-2);
}
tr:hover td { background: rgb(248 250 252 / 80%); }
tr:last-child td { border-bottom: none; }
.mono { font-family: ui-monospace, 'JetBrains Mono', Menlo, monospace; font-size: 11px; color: var(--muted); }

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}
.tag-view { background: var(--accent-soft); color: var(--accent); }
.tag-download { background: var(--success-soft); color: var(--success); }
.tag-denied { background: var(--danger-soft); color: var(--danger); }
.tag-upload { background: var(--warning-soft); color: var(--warning); }
.tag-active { background: var(--success-soft); color: var(--success); }
.tag-inactive { background: var(--surface-2); color: var(--muted); }

/* Upload */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 56px 32px;
  text-align: center;
  background: var(--surface);
  transition: border-color 0.15s, background 0.15s;
  cursor: pointer;
}
.upload-zone:hover { border-color: var(--accent); background: var(--accent-soft); }
.upload-zone svg { width: 48px; height: 48px; color: var(--accent); margin: 0 auto 16px; }
.upload-zone strong { display: block; color: var(--fg); font-size: 15px; margin-bottom: 4px; }
.alert-warn {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  background: var(--warning-soft);
  border: 1px solid #fde68a;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: #92400e;
  margin: 16px 0;
}
.alert-warn svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }

/* Viewer */
.viewer-layout { display: grid; grid-template-columns: 1fr 300px; gap: 20px; }
.viewer-toolbar {
  display: flex;
  gap: 8px;
  padding: 10px 14px;
  background: #323639;
  border-radius: var(--radius) var(--radius) 0 0;
  color: #e8eaed;
  font-size: 12px;
  align-items: center;
}
.viewer-frame {
  background: #525659;
  min-height: 480px;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 13px;
  border-radius: 0 0 var(--radius) var(--radius);
  text-align: center;
  padding: 24px;
}
.viewer-meta { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.viewer-meta h3 { font-size: 15px; font-family: var(--font); font-weight: 600; margin-bottom: 16px; }
.viewer-meta dl { margin: 0; }
.viewer-meta dt { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin-top: 14px; }
.viewer-meta dd { margin: 3px 0 0; font-weight: 500; font-size: 13px; }

.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; align-items: center; }
.filters input, .filters select {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 13px;
}

/* Launcher (index) */
.launcher-hero { padding-block: clamp(48px, 8vw, 72px); border-bottom: 1px solid var(--border); background: var(--surface); }
.launcher-hero h1 { font-size: clamp(36px, 5vw, 52px); margin-bottom: 12px; }
.screen-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; padding-block: 32px; }
.screen-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.screen-card:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.screen-card h2 { font-size: 18px; font-family: var(--font); font-weight: 600; }
.screen-card .module-tag {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  font-weight: 700;
}

@media (max-width: 960px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-panel-left { display: none; }
  .app-layout { grid-template-columns: 1fr; }
  .nav-toggle,
  .nav-close { display: inline-flex; }
  .topbar-brand { display: inline-flex; }
  .topbar { justify-content: flex-start; gap: 10px; }
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: min(var(--sidebar-w), 88vw);
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: var(--shadow);
  }
  .app-layout.is-nav-open .sidebar { transform: translateX(0); }
  .app-layout.is-nav-open .nav-backdrop { display: block; }
  .topbar { padding-inline: 16px; }
  .topbar-name { max-width: 120px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .viewer-layout { grid-template-columns: 1fr; }
}
