.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 88px 16px 40px;
  background:
    radial-gradient(900px 420px at 10% -10%, rgba(239, 68, 68, 0.18), transparent 55%),
    radial-gradient(700px 380px at 100% 0%, rgba(249, 115, 22, 0.12), transparent 50%),
    var(--dark);
}
.auth-card {
  width: min(440px, 100%);
  background: rgba(17, 24, 39, 0.92);
  border: 1px solid var(--card-border);
  border-radius: 18px;
  padding: 28px 24px 22px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}
.auth-card h1 { font-size: 26px; letter-spacing: -0.4px; margin-bottom: 6px; }
.auth-card .lede { color: var(--text-muted); font-size: 14px; margin-bottom: 18px; }
.auth-card label { display: block; font-size: 12px; font-weight: 600; color: var(--text-muted); margin: 12px 0 6px; }
.auth-card input {
  width: 100%;
  background: #0b1220;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text);
  border-radius: 10px;
  padding: 11px 12px;
  font: 15px/1.3 Inter, sans-serif;
}
.auth-card input:focus { outline: 2px solid rgba(239, 68, 68, 0.45); border-color: transparent; }
.field-error { color: #fca5a5; font-size: 12px; margin-top: 4px; }
.form-banner {
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  margin-bottom: 12px;
  line-height: 1.45;
}
.form-banner.err { background: rgba(239, 68, 68, 0.12); color: #fecaca; }
.form-banner.ok { background: rgba(16, 185, 129, 0.12); color: #a7f3d0; }
.form-banner.warn { background: rgba(251, 191, 36, 0.12); color: #fde68a; }
.auth-card button.btn-primary, .auth-card a.btn-primary { width: 100%; display: inline-block; text-align: center; margin-top: 16px; }
.auth-card button:disabled { opacity: 0.6; cursor: wait; }
.auth-links { display: flex; justify-content: space-between; gap: 12px; margin-top: 14px; font-size: 13px; color: var(--text-muted); }
.auth-links a { color: #f8fafc; text-decoration: underline; text-underline-offset: 3px; }
.oauth-row { display: grid; gap: 8px; margin-top: 14px; }
.oauth-row button {
  width: 100%;
  background: transparent;
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding: 10px 12px;
  font-weight: 600;
}
.oauth-row button:hover { background: rgba(255, 255, 255, 0.04); }
.link-box {
  margin-top: 10px;
  background: #0b1220;
  border-radius: 10px;
  padding: 10px;
  word-break: break-all;
  font-size: 13px;
}
.nav-mobile .btn-ghost,
.nav-mobile .btn-primary { text-align: center; }
.nav-mobile .btn-primary { color: #fff; }

.has-site-nav .dash,
.has-site-nav .adm,
.has-site-nav .login-admin { padding-top: 66px; }
.has-site-nav .dash-side,
.has-site-nav .adm-side { top: 66px; height: calc(100vh - 66px); }
.dash {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 248px 1fr;
  background: var(--dark);
}
.dash-side {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 18px 14px;
  border-right: 1px solid var(--border);
  background: #0c1222;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.dash-side .logo { margin: 4px 8px 16px; }
.dash-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
  background: transparent;
  border: 0;
  text-align: left;
  width: 100%;
}
.dash-link svg { width: 18px; height: 18px; flex: none; }
.dash-link:hover { background: rgba(255, 255, 255, 0.04); color: white; }
.dash-link.active { background: rgba(239, 68, 68, 0.14); color: white; }
.dash-link.danger { margin-top: auto; color: #fca5a5; }
.dash-main { padding: 28px 28px 60px; min-width: 0; }
.dash-top { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; margin-bottom: 22px; }
.dash-top h1 { font-size: 28px; letter-spacing: -0.5px; }
.dash-top p { color: var(--text-muted); font-size: 14px; }
.profile-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 12px 6px 6px;
}
.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--red), var(--orange));
  color: white;
}
.avatar svg { width: 18px; height: 18px; }
.stat-grid, .card-grid { display: grid; gap: 14px; }
.stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 18px; }
.panel {
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 16px 18px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
}
.panel h2 { font-size: 16px; margin-bottom: 8px; }
.panel .num { font-size: 28px; font-weight: 800; letter-spacing: -0.5px; }
.panel .hint { color: var(--text-dim); font-size: 12px; }
.row-list { display: flex; flex-direction: column; gap: 8px; }
.doc-row, .act-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.18);
}
.doc-row strong, .act-row strong { display: block; font-size: 14px; }
.doc-row span, .act-row span { color: var(--text-dim); font-size: 12px; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.row-actions button, .row-actions a, .mini {
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: transparent;
  color: var(--text);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
}
.tools-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.tools-bar input, .stack input {
  background: #0b1220;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 12px;
  font: 14px Inter, sans-serif;
}
.tools-bar input { min-width: min(280px, 100%); }
.stack { display: grid; gap: 8px; max-width: 460px; }
.stack label { font-size: 12px; color: var(--text-muted); font-weight: 600; }
.empty {
  padding: 28px 8px;
  text-align: center;
  color: var(--text-muted);
}
.empty a { color: #fdba74; }
.status-ok { color: #6ee7b7; }
.status-no { color: #fcd34d; }
@media (max-width: 860px) {
  .dash { grid-template-columns: 1fr; }
  .has-site-nav .dash-side,
  .dash-side {
    position: sticky;
    top: 66px;
    height: auto;
    z-index: 20;
    flex-direction: row;
    overflow: auto;
    gap: 4px;
  }
  .dash-side .logo { display: none; }
  .dash-link { width: auto; white-space: nowrap; }
  .stat-grid { grid-template-columns: 1fr; }
  .dash-main { padding: 18px 14px 48px; }
}

/* ---- Mobile dashboard (≤768px only; desktop untouched) ---- */
@media (max-width: 768px) {
  .dash-main { padding: 14px 14px 48px; }
  /* Header row: compact title, description below, profile card full width */
  .dash-main { display: flex; flex-direction: column; }
  .dash-main > * { order: 4; }
  .dash-top { display: contents; }
  .dash-top .profile-pill { order: 1; margin-bottom: 12px; border-radius: 14px; padding: 8px 12px 8px 8px; min-width: 0; }
  .dash-top .profile-pill > div { min-width: 0; }
  .dash-top .profile-pill span:not(.avatar) { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .dash-top h1 { font-size: 20px; line-height: 1.25; letter-spacing: -0.3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .dash-top p { font-size: 13px; line-height: 1.45; margin-top: 4px; }
  .dash-top .dash-title { order: 3; margin-bottom: 14px; min-width: 0; }
  .dash-top--home .dash-title { display: none; }

  /* Stats compact grid, cards stacked */
  .dash-stats, .stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 14px; }
  .dash-stats .panel, .stat-grid .panel { padding: 12px 10px; border-radius: 14px; }
  .dash-stats .hint { font-size: 11px; line-height: 1.3; min-height: 28px; }
  .dash-stats .num { font-size: 22px; }
  .dash-home-grid { grid-template-columns: 1fr !important; }
  .dash-actions { display: grid !important; grid-template-columns: 1fr 1fr; gap: 10px !important; }
  .dash-actions > a { display: flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 12px; border-radius: 12px; white-space: nowrap; font-size: 14px; text-align: center; }
}

/* ---- Mobile slide-in drawer for dashboard + admin (≤768px only) ---- */
.mdrawer-toggle, .mdrawer-head, .mdrawer-ov, .adm-mprofile { display: none; }
@media (max-width: 768px) {
  .dash-side, .has-site-nav .dash-side, .adm-side, .has-site-nav .adm-side {
    display: flex !important; flex-direction: column; gap: 4px;
    position: fixed; top: 0; left: 0; bottom: 0; height: 100vh; height: 100dvh;
    width: min(300px, 84vw); z-index: 1002; overflow-y: auto; overscroll-behavior: contain;
    padding: 0 12px 18px; background: #0b1120; border-right: 1px solid rgba(255,255,255,.08);
    box-shadow: 18px 0 48px rgba(0,0,0,.45);
    transform: translateX(-105%); visibility: hidden;
    transition: transform .3s cubic-bezier(.22,.8,.24,1), visibility 0s linear .3s;
  }
  .dash-side.open, .adm-side.open { transform: translateX(0); visibility: visible; transition: transform .3s cubic-bezier(.22,.8,.24,1), visibility 0s; }
  .dash-side .logo, .adm-side .adm-brand { display: none; }
  .dash-side .dash-link, .adm-side .adm-link { width: 100%; white-space: nowrap; min-height: 46px; padding: 11px 12px; font-size: 15px; border-radius: 12px; }
  .dash-side .dash-link.active, .adm-side .adm-link.active { color: inherit; background: transparent; box-shadow: none; }
  .dash-side .dash-link.active { color: var(--text-muted); }
  .adm-side .adm-link.active { color: #94a3b8; }
  .dash-side .dash-link[data-mactive], .adm-side .adm-link[data-mactive] { color: #fff; background: linear-gradient(90deg, rgba(239,68,68,.24), rgba(249,115,22,.08)); box-shadow: inset 3px 0 0 #f97316; }
  .dash-side .dash-link[data-mactive] svg { color: #fb923c; }
  .dash-side .dash-link.danger, .adm-side .adm-link.danger { margin-top: auto; color: #fca5a5; border-top: 1px solid rgba(255,255,255,.06); border-radius: 0 0 12px 12px; }
  .mdrawer-head {
    display: flex; align-items: center; justify-content: space-between;
    position: sticky; top: 0; z-index: 1; background: #0b1120;
    margin: 0 -12px 8px; padding: 14px 12px 12px 22px; border-bottom: 1px solid rgba(255,255,255,.07);
    font: 800 12px/1 Inter, sans-serif; letter-spacing: .14em; text-transform: uppercase; color: #fb923c;
  }
  .mdrawer-x, .mdrawer-toggle {
    display: grid; place-items: center; flex: none; width: 40px; height: 40px; padding: 0; cursor: pointer;
    border-radius: 12px; border: 1px solid rgba(255,255,255,.12); background: rgba(255,255,255,.05); color: #e8eefc;
    -webkit-tap-highlight-color: transparent;
  }
  .mdrawer-x svg, .mdrawer-toggle svg { width: 20px; height: 20px; }
  .mdrawer-toggle { background: linear-gradient(135deg, rgba(239,68,68,.18), rgba(249,115,22,.10)); border-color: rgba(249,115,22,.35); color: #fdba74; }
  .mdrawer-toggle:active, .mdrawer-x:active { transform: scale(.94); }
  .mdrawer-ov {
    display: block; position: fixed; inset: 0; z-index: 1001; background: rgba(2,6,16,.62);
    backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
    opacity: 0; pointer-events: none; transition: opacity .3s ease;
  }
  .mdrawer-ov.show { opacity: 1; pointer-events: auto; }
  .dash-top .profile-pill { gap: 10px; }

  /* Admin: same profile card + drawer trigger; old "Menu" button hidden */
  .adm-menu { display: none !important; }
  .adm-mprofile {
    display: flex; align-items: center; gap: 10px; margin-bottom: 14px; min-width: 0;
    border-radius: 14px; padding: 8px 12px 8px 8px;
  }
  .adm-mprofile > div { min-width: 0; }
  .adm-mprofile strong { display: block; font-size: 13px; color: #fff; }
  .adm-mprofile > div > span { display: block; color: #94a3b8; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
@media (max-width: 768px) {
  .adm-side .mdrawer-head span { font-size: 17px; letter-spacing: .14em; }
}

/* My Documents / Recent Files */
.doc-main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.doc-main > div { min-width: 0; }
.doc-main strong { overflow-wrap: anywhere; }
.doc-type { flex: 0 0 auto; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 10px; font-size: 10.5px !important; font-weight: 800; letter-spacing: .04em; color: #fff !important; background: linear-gradient(135deg, #f97316, #ef4444); }
.doc-type.t-docx, .doc-type.t-doc { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.doc-type.t-xlsx { background: linear-gradient(135deg, #22c55e, #15803d); }
.doc-type.t-pptx { background: linear-gradient(135deg, #f59e0b, #d97706); }
.doc-type.t-zip { background: linear-gradient(135deg, #8b5cf6, #6366f1); }
.doc-type.t-jpg, .doc-type.t-jpeg, .doc-type.t-png { background: linear-gradient(135deg, #14b8a6, #0d9488); }
.doc-row .doc-note { display: block; margin-top: 2px; color: #fcd34d; }
.doc-row a.doc-tool { color: #fdba74; font-weight: 600; }
.row-actions .danger { color: #fda4af; }
.mini.on { border-color: rgba(249, 115, 22, .55); color: #fdba74; }
.doc-usage { margin-bottom: 14px; padding: 12px 14px; border-radius: 12px; border: 1px solid rgba(255, 255, 255, .08); background: rgba(0, 0, 0, .18); }
.doc-usage-top { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-dim); margin-bottom: 8px; }
.doc-usage-top strong { color: var(--text); }
.doc-usage-bar { height: 6px; border-radius: 99px; background: rgba(255, 255, 255, .08); overflow: hidden; }
.doc-usage-bar i { display: block; height: 100%; min-width: 2px; background: linear-gradient(90deg, #f97316, #ef4444); border-radius: inherit; }
@media (max-width: 640px) {
  .doc-row { flex-direction: column; align-items: stretch; }
  .doc-row .row-actions { justify-content: flex-start; }
}
