/* ═══════════════════════════════════════════════════════════════
   KeelDraft — Global Stylesheet
   ═══════════════════════════════════════════════════════════════ */

/* ── Custom properties (design tokens) ─────────────────────── */
:root {
  --primary:        #1e3a5f;
  --primary-light:  #2563eb;
  --primary-hover:  #1d4ed8;
  --accent:         #f59e0b;
  --bg:             #f1f5f9;
  --surface:        #ffffff;
  --border:         #e2e8f0;
  --text:           #1e293b;
  --text-muted:     #64748b;
  --success:        #10b981;
  --danger:         #ef4444;
  --danger-hover:   #dc2626;
  --warning:        #f59e0b;
  --radius:         10px;
  --radius-lg:      16px;
  --shadow-sm:      0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow:         0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -1px rgba(0,0,0,.06);
  --shadow-lg:      0 10px 25px -5px rgba(0,0,0,.15), 0 4px 6px -2px rgba(0,0,0,.05);
  --transition:     all .2s ease;
  --sidebar-w:      240px;
  --header-h:       64px;
  --font:           'Inter', system-ui, -apple-system, sans-serif;
}

/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body { font-family: var(--font); color: var(--text); background: var(--bg); line-height: 1.5; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
input, textarea, select { font-family: inherit; }
img { max-width: 100%; }

/* ── Utility classes ────────────────────────────────────────── */
.hidden  { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); }

/* ══════════════════════════════════════════════════════════════
   LOGIN PAGE
   ══════════════════════════════════════════════════════════════ */

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f2044 0%, #1e3a5f 50%, #0c1a38 100%);
  padding: 20px;
}

.login-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 440px;
  overflow: hidden;
}

.login-header {
  background: linear-gradient(135deg, #1e3a5f, #2563eb);
  padding: 36px 40px 30px;
  text-align: center;
  color: white;
}

.login-logo {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.login-logo-mark {
  width: 48px;
  height: 48px;
  background: rgba(255,255,255,.15);
  border: 2px solid rgba(255,255,255,.3);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -1px;
}

.login-logo-text {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.login-tagline {
  color: rgba(255,255,255,.7);
  font-size: 13px;
  letter-spacing: .5px;
  text-transform: uppercase;
}

/* ── Login tabs ─────────────────────────────────────────────── */
.login-tabs {
  display: flex;
  border-bottom: 2px solid var(--border);
  background: #f8fafc;
}

.login-tab {
  flex: 1;
  padding: 14px;
  border: none;
  background: transparent;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
}

.login-tab:hover { color: var(--primary); background: #eef2ff; }

.login-tab.active {
  color: var(--primary-light);
  border-bottom-color: var(--primary-light);
  background: var(--surface);
}

/* ── Login forms ────────────────────────────────────────────── */
.login-body { padding: 32px 40px 36px; }

.login-form { display: none; }
.login-form.active { display: block; }

.login-form h2 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}

.login-form p.subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

/* ── Form elements ──────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }

label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 6px;
}

input[type="text"],
input[type="password"],
input[type="number"],
textarea,
select {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 15px;
  color: var(--text);
  background: var(--surface);
  transition: var(--transition);
  outline: none;
  -webkit-appearance: none;
}

input:focus, textarea:focus, select:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}

.pin-input {
  text-align: center;
  font-size: 28px !important;
  font-weight: 700 !important;
  letter-spacing: 10px;
  padding: 14px !important;
}

.error-msg {
  display: none;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: var(--danger);
  font-size: 13px;
  padding: 10px 14px;
  border-radius: var(--radius);
  margin-bottom: 16px;
}

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  text-align: center;
  justify-content: center;
}

.btn-primary {
  background: var(--primary-light);
  color: white;
}
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: transparent;
  color: var(--text);
  border: 1.5px solid var(--border);
}
.btn-secondary:hover { background: var(--bg); border-color: #94a3b8; }

.btn-danger {
  background: var(--danger);
  color: white;
}
.btn-danger:hover { background: var(--danger-hover); }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: none;
  padding: 8px 12px;
}
.btn-ghost:hover { color: var(--text); background: var(--bg); }

.btn-full { width: 100%; }

.btn-sm { padding: 6px 12px; font-size: 13px; }

.btn:disabled { opacity: .5; cursor: not-allowed; transform: none !important; }

/* ── Spinner ────────────────────────────────────────────────── */
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin .8s linear infinite;
  display: inline-block;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ══════════════════════════════════════════════════════════════
   APP LAYOUT
   ══════════════════════════════════════════════════════════════ */

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

/* ── Header ─────────────────────────────────────────────────── */
.app-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 16px;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.3);
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.5px;
  flex-shrink: 0;
}

.header-logo-mark {
  width: 36px;
  height: 36px;
  background: rgba(255,255,255,.15);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 800;
}

.header-nav {
  display: flex;
  gap: 4px;
  margin-left: 12px;
}

.header-nav-btn {
  background: transparent;
  border: none;
  color: rgba(255,255,255,.7);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}
.header-nav-btn:hover, .header-nav-btn.active {
  background: rgba(255,255,255,.15);
  color: white;
}

.header-spacer { flex: 1; }

.header-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-user-name { font-size: 14px; font-weight: 500; }

.role-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: .5px;
}

.role-badge-admin    { background: var(--accent); color: #78350f; }
.role-badge-designer { background: #818cf8; color: #1e1b4b; }
.role-badge-viewer   { background: #34d399; color: #064e3b; }

.btn-logout {
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.2);
  color: white;
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}
.btn-logout:hover { background: rgba(255,255,255,.2); }

.menu-toggle {
  display: none;
  background: transparent;
  border: none;
  color: white;
  padding: 8px;
  cursor: pointer;
  border-radius: 6px;
}
.menu-toggle:hover { background: rgba(255,255,255,.1); }
.menu-toggle svg { display: block; }

/* ── Body (below header) ────────────────────────────────────── */
.app-body {
  margin-top: var(--header-h);
  display: flex;
  flex: 1;
}

/* ── Sidebar ────────────────────────────────────────────────── */
.app-sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  position: fixed;
  top: var(--header-h);
  bottom: 0;
  left: 0;
  overflow-y: auto;
  padding: 20px 12px;
  transition: transform .25s ease;
  z-index: 90;
}

.sidebar-section { margin-bottom: 28px; }
.sidebar-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 0 12px;
  margin-bottom: 6px;
}

.sidebar-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition);
  text-align: left;
}
.sidebar-btn:hover { background: var(--bg); }
.sidebar-btn.active { background: #eff6ff; color: var(--primary-light); }
.sidebar-btn .icon { width: 20px; text-align: center; font-size: 16px; }

/* ── Main content ────────────────────────────────────────────── */
.app-main {
  flex: 1;
  margin-left: var(--sidebar-w);
  padding: 28px;
  min-height: calc(100vh - var(--header-h));
}

/* ── Toolbar (search + upload) ──────────────────────────────── */
.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.toolbar h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  flex: 1;
  min-width: 0;
}

.search-wrap {
  position: relative;
  flex-shrink: 0;
}
.search-wrap svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}
.search-input {
  padding: 9px 14px 9px 38px !important;
  width: 260px;
  border-radius: 50px !important;
}

/* ── Drawing grid ────────────────────────────────────────────── */
.drawings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}

/* ── Drawing card ────────────────────────────────────────────── */
.drawing-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: var(--transition);
  cursor: pointer;
}
.drawing-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
  border-color: #bfdbfe;
}

.card-preview {
  height: 140px;
  background: linear-gradient(135deg, #e0e7ff, #dbeafe);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.card-preview-icon {
  font-size: 56px;
  opacity: .6;
  user-select: none;
}

.card-preview-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(37,99,235,.85);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: 4px;
  letter-spacing: .5px;
}

.card-body { padding: 16px; flex: 1; }

.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-meta {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.card-description {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-actions {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 6px;
  background: #fafafa;
}

/* ── Empty state ─────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-muted);
  grid-column: 1 / -1;
}
.empty-state-icon { font-size: 64px; margin-bottom: 16px; opacity: .4; }
.empty-state h3 { font-size: 18px; font-weight: 600; color: var(--text); margin-bottom: 8px; }
.empty-state p { font-size: 14px; max-width: 320px; margin: 0 auto 20px; }

/* ── Users table ─────────────────────────────────────────────── */
.users-section { }
.users-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}
.users-toolbar h1 { font-size: 22px; font-weight: 700; flex: 1; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}

.data-table th {
  background: #f8fafc;
  padding: 12px 16px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .7px;
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 14px 16px;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: #f8fafc; }

.data-table .actions-cell { display: flex; gap: 6px; flex-wrap: wrap; }

/* ══════════════════════════════════════════════════════════════
   MODALS
   ══════════════════════════════════════════════════════════════ */

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.55);
  backdrop-filter: blur(4px);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.active { display: flex; }

.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp .2s ease;
}

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

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 1;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.modal-header h2 { font-size: 18px; font-weight: 600; }

.modal-close {
  background: none;
  border: none;
  font-size: 22px;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  transition: var(--transition);
}
.modal-close:hover { background: var(--bg); color: var(--text); }

.modal-body { padding: 24px; }
.modal-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  background: #fafafa;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ── File upload zone ────────────────────────────────────────── */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  background: #fafafa;
  position: relative;
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--primary-light);
  background: #eff6ff;
}
.upload-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.upload-zone-icon { font-size: 40px; margin-bottom: 12px; }
.upload-zone p { color: var(--text-muted); font-size: 14px; }
.upload-zone strong { color: var(--primary-light); }
.upload-file-name {
  display: none;
  margin-top: 10px;
  font-size: 13px;
  color: var(--success);
  font-weight: 500;
}

/* ── Upload progress ─────────────────────────────────────────── */
.upload-progress {
  display: none;
  margin-top: 12px;
}
.progress-bar-wrap {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: var(--primary-light);
  border-radius: 3px;
  transition: width .3s ease;
  width: 0;
}
.progress-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  text-align: center;
}

/* ── Confirm modal ───────────────────────────────────────────── */
.confirm-icon { font-size: 48px; text-align: center; margin-bottom: 16px; }
.confirm-msg  { text-align: center; color: var(--text-muted); font-size: 15px; }
.confirm-title { text-align: center; font-size: 18px; font-weight: 600; margin-bottom: 8px; }

/* ══════════════════════════════════════════════════════════════
   PDF VIEWER MODAL
   ══════════════════════════════════════════════════════════════ */

#viewer-modal {
  background: rgba(10,15,30,.92);
  align-items: stretch;
  justify-content: stretch;
  padding: 0;
}

.viewer-wrapper {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100vh;
  max-width: none;
  border-radius: 0;
  background: #1a1a2e;
  color: white;
  overflow: hidden;
}

.viewer-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  height: 56px;
  background: #12122a;
  border-bottom: 1px solid rgba(255,255,255,.1);
  flex-shrink: 0;
}

#viewer-title {
  font-size: 15px;
  font-weight: 500;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.viewer-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.viewer-btn {
  background: rgba(255,255,255,.1);
  border: none;
  color: white;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  transition: var(--transition);
}
.viewer-btn:hover { background: rgba(255,255,255,.2); }
.viewer-btn:disabled { opacity: .35; cursor: not-allowed; }

.viewer-page-info {
  font-size: 13px;
  color: rgba(255,255,255,.7);
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 90px;
  justify-content: center;
}

.viewer-zoom { font-size: 13px; color: rgba(255,255,255,.7); min-width: 50px; text-align: center; }

.viewer-sep {
  width: 1px;
  height: 24px;
  background: rgba(255,255,255,.15);
}

.viewer-close {
  background: rgba(239,68,68,.2);
  border: none;
  color: #fca5a5;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}
.viewer-close:hover { background: rgba(239,68,68,.4); color: white; }

.viewer-body {
  flex: 1;
  overflow: auto;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px;
  background: #252540;
}

#pdf-canvas {
  box-shadow: 0 8px 40px rgba(0,0,0,.6);
  display: block;
  max-width: 100%;
}

.viewer-loading {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: rgba(255,255,255,.7);
  min-height: 300px;
  width: 100%;
}

.viewer-loading .spinner {
  width: 40px;
  height: 40px;
  border-width: 3px;
}

.viewer-error {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: #fca5a5;
  min-height: 300px;
  font-size: 15px;
  text-align: center;
}

/* ══════════════════════════════════════════════════════════════
   TOAST NOTIFICATIONS
   ══════════════════════════════════════════════════════════════ */

#toast-container {
  position: fixed;
  top: 80px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 360px;
}

.toast {
  padding: 14px 18px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toastIn .25s ease;
  cursor: pointer;
}

@keyframes toastIn {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0);     opacity: 1; }
}

.toast-success { background: #dcfce7; color: #166534; border-left: 4px solid var(--success); }
.toast-error   { background: #fef2f2; color: #991b1b; border-left: 4px solid var(--danger); }
.toast-info    { background: #dbeafe; color: #1e40af; border-left: 4px solid var(--primary-light); }

/* ══════════════════════════════════════════════════════════════
   PAGE LOADING SCREEN
   ══════════════════════════════════════════════════════════════ */

#loading-screen {
  position: fixed;
  inset: 0;
  background: var(--primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  color: white;
  z-index: 9999;
}

#loading-screen .spinner {
  width: 48px;
  height: 48px;
  border-width: 3px;
}

#loading-screen p { color: rgba(255,255,255,.7); font-size: 15px; }

/* ══════════════════════════════════════════════════════════════
   FORM HELPERS
   ══════════════════════════════════════════════════════════════ */

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

.modal .error-msg { margin-bottom: 12px; }

/* ── Role selector in user form ──────────────────────────────── */
.role-selector { display: flex; gap: 8px; }
.role-option {
  flex: 1;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 8px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
}
.role-option:hover { border-color: #94a3b8; color: var(--text); }
.role-option.selected { border-color: var(--primary-light); background: #eff6ff; color: var(--primary-light); }
.role-option .role-icon { font-size: 22px; display: block; margin-bottom: 4px; }

/* ══════════════════════════════════════════════════════════════
   RESPONSIVE — TABLET
   ══════════════════════════════════════════════════════════════ */

@media (max-width: 1024px) {
  .search-input { width: 200px; }
  .drawings-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
}

/* ══════════════════════════════════════════════════════════════
   RESPONSIVE — MOBILE
   ══════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
  .menu-toggle { display: flex; }

  .header-user-name { display: none; }

  .app-sidebar {
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
  }
  .app-sidebar.open { transform: translateX(0); }

  /* Sidebar overlay on mobile */
  .sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.4);
    z-index: 89;
  }
  .sidebar-backdrop.active { display: block; }

  .app-main {
    margin-left: 0;
    padding: 16px;
  }

  .toolbar { gap: 10px; }
  .toolbar h1 { font-size: 18px; }
  .search-input { width: 100%; }
  .search-wrap { width: 100%; order: 3; }

  .drawings-grid { grid-template-columns: 1fr; }

  .modal { max-width: 100%; margin: auto 0 0; border-radius: var(--radius-lg) var(--radius-lg) 0 0; max-height: 80vh; }
  .modal-overlay { align-items: flex-end; padding: 0; }

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

  .data-table { font-size: 13px; }
  .data-table th, .data-table td { padding: 10px 12px; }
  .data-table .hide-mobile { display: none; }

  .login-header { padding: 28px 24px 22px; }
  .login-body { padding: 24px; }

  .viewer-header { padding: 0 12px; gap: 8px; }
  .viewer-body { padding: 12px; }
  .viewer-controls { gap: 4px; }

  .header-nav { display: none; }
}

@media (max-width: 400px) {
  .login-logo-text { font-size: 22px; }
  .login-body { padding: 20px 16px; }
}
