/* =========================================================
   Proxima Portal — warm pastel theme
   Matches the proximaservices.org site: cream page, grainy
   pastel panels in the Proxima palette (green, gold, orange —
   no blue), Inter Tight type. Shared by /client and /admin.
   ========================================================= */

:root {
  /* Brand */
  --green: #17864a;
  --green-d: #0f6b3a;
  --green-l: #e5f0e8;
  --gold: #c9a227;
  --gold-l: #f4e9c4;
  --orange: #e07a2c;

  /* Surfaces & text */
  --ink: #10291d;
  --ink-2: #4d5a51;
  --ink-3: #6d776f;
  --cream: #fbf6ef;
  --paper: #fffdf9;
  --line: rgb(16 41 29 / 0.13);
  --line-2: rgb(16 41 29 / 0.22);
  --danger: #b4432a;
  --danger-l: #f9e4dc;

  --font: "Inter Tight", "Inter", "Helvetica Neue", Arial, sans-serif;
  --r: 10px;
  --r-lg: 22px;
  --shadow: 0 1px 2px rgb(16 41 29 / 0.04), 0 12px 32px -12px rgb(16 41 29 / 0.14);
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .9 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Pastel tones: base gradient, glow, deep accent. */
.tone-lemon   { --b1: #f4eedd; --b2: #f4e9c4; --glow: 240 205 92; --deep: #7d6206; }
.tone-peach   { --b1: #f8dfcb; --b2: #f8cdaa; --glow: 242 140 72; --deep: #9a4a0e; }
.tone-sage    { --b1: #eef0e1; --b2: #e2ecca; --glow: 150 200 96; --deep: #3f6b17; }
.tone-emerald { --b1: #e5f0e8; --b2: #d0e7d9; --glow: 46 160 100; --deep: #0f6b3a; }

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  background: var(--cream);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, p { margin: 0; }
h1, h2, h3, h4 { font-weight: 500; letter-spacing: -0.02em; }
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }

[hidden] { display: none !important; }

/* ---------- Pastel wash + grain ---------- */

.washed { position: relative; isolation: isolate; overflow: hidden; }
.washed::before,
.washed::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}
.washed::before {
  background:
    radial-gradient(58% 72% at 86% 76%, rgb(var(--glow) / 0.7), rgb(var(--glow) / 0) 70%),
    radial-gradient(44% 58% at 18% 0%, rgb(var(--glow) / 0.32), rgb(var(--glow) / 0) 72%),
    linear-gradient(180deg, var(--b1), var(--b2));
}
.washed::after {
  background-image: var(--grain);
  opacity: 0.18;
  mix-blend-mode: multiply;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-2);
}
.eyebrow::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
}

/* ---------- Login screen ---------- */

/* A calm, single-hue layout: flat form card on the left, a soft
   gradient panel on the right with two chart previews, the lower one
   running off the panel's edge. */
.login-shell {
  --l-ink: #12301f;
  --l-mute: #6f7d74;
  --l-line: rgb(18 48 31 / 0.1);
  --l-line-2: #3e9b67;
  position: relative;
  isolation: isolate;
  height: 100vh;
  height: 100svh;
  display: flex;
  gap: clamp(24px, 4.4vw, 72px);
  padding: clamp(12px, 4vh, 48px) clamp(16px, 2.2vw, 36px);
  overflow: hidden;
  background: linear-gradient(135deg, #e9f2ec 0%, #f6faf6 38%, #eef5ef 100%);
  color: var(--l-ink);
}
.login-shell::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image: var(--grain);
  opacity: 0.08;
  mix-blend-mode: multiply;
}

.login-side {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: clamp(16px, 3vh, 28px) clamp(24px, 4vw, 64px);
  background: rgb(255 255 255 / 0.55);
  border: 1px solid rgb(255 255 255 / 0.9);
  border-radius: 8px;
}

.login-logo { position: absolute; top: 24px; left: 28px; }
.login-logo img { height: 30px; width: auto; }

.login-card {
  width: 100%;
  max-width: 440px;
  margin: auto;
  padding: clamp(40px, 6vh, 56px) 0 clamp(4px, 2vh, 24px);
}

.login-brand { margin-bottom: clamp(16px, 3.6vh, 36px); text-align: center; }
.login-brand h1 {
  font-size: clamp(26px, min(2.5vw, 4.2vh), 37px);
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.015em;
}
.login-brand p {
  margin: clamp(8px, 1.8vh, 18px) auto 0;
  max-width: 380px;
  color: var(--l-mute);
  font-size: clamp(16px, min(1.7vw, 2.7vh), 25px);
  font-weight: 300;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.login-card .field { margin-bottom: clamp(10px, 2.2vh, 20px); }
.login-card .field label { font-size: clamp(15px, 2.2vh, 17px); font-weight: 400; color: var(--l-ink); margin-bottom: clamp(4px, 1vh, 10px); }
.login-card .field input {
  height: clamp(42px, 6vh, 54px);
  padding: 0 16px;
  background: #fff;
  border: 1px solid var(--l-line);
  border-radius: 8px;
  font-size: 16px;
  font-weight: 300;
}
.login-card .field input::placeholder { color: #a3ada6; }
.login-card .field input:focus { border-color: #8cc4a2; box-shadow: 0 0 0 4px rgb(23 134 74 / 0.08); }

.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 50px; }
.pw-toggle {
  position: absolute;
  top: 50%;
  right: 8px;
  width: 38px;
  height: 38px;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #a3ada6;
}
.pw-toggle:hover { color: var(--l-ink); }
.pw-toggle svg { width: 18px; height: 18px; }
.pw-toggle .eye-off { display: none; }
.pw-toggle[aria-pressed="true"] .eye-on { display: none; }
.pw-toggle[aria-pressed="true"] .eye-off { display: block; }

/* Pale gradient primary, as in the reference */
.login-card .btn-primary {
  width: 100%;
  height: clamp(44px, 6.2vh, 56px);
  margin-top: clamp(8px, 2.4vh, 24px);
  border: 1px solid #a9d3b9;
  border-radius: 8px;
  background: linear-gradient(90deg, #eaf4ed 0%, #cfe7d8 100%);
  color: var(--l-ink);
  font-size: 17px;
  font-weight: 400;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.7);
}
.login-card .btn-primary:hover { background: linear-gradient(90deg, #d9ecdf 0%, #b9dcc6 100%); color: var(--l-ink); border-color: #8cc4a2; }
.login-card .btn-primary .spinner { border-color: rgb(18 48 31 / 0.2); border-top-color: var(--green); }

.alt-actions { display: grid; gap: clamp(8px, 1.5vh, 14px); margin-top: clamp(16px, 5vh, 80px); }
.login-card .btn-alt {
  width: 100%;
  height: clamp(42px, 6vh, 54px);
  gap: 14px;
  border: 1px solid var(--l-line);
  border-radius: 8px;
  background: #fff;
  color: var(--l-ink);
  font-size: 16px;
  font-weight: 300;
}
.login-card .btn-alt:hover { background: #fff; color: var(--l-ink); border-color: #a9d3b9; }
.login-card .btn-alt svg { width: 20px; height: 20px; }

.login-note {
  margin-top: clamp(10px, 2.6vh, 28px);
  font-size: 14px;
  font-weight: 300;
  color: #9aa59e;
  text-align: center;
}
.login-note a { color: var(--l-ink); font-weight: 400; text-underline-offset: 3px; }

/* Right-hand art panel */
.login-art {
  position: relative;
  isolation: isolate;
  flex: 1 1 0;
  min-width: 0;
  overflow: hidden;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: clamp(20px, 5vh, 96px);
  padding: clamp(20px, 4.5vh, 72px) 0;
  background:
    radial-gradient(60% 50% at 100% 0%, rgb(160 214 180 / 0.55), rgb(160 214 180 / 0) 70%),
    radial-gradient(70% 60% at 0% 100%, rgb(196 228 206 / 0.6), rgb(196 228 206 / 0) 70%),
    linear-gradient(180deg, #dcebe1, #e6f1e9 60%, #dceade);
}
/* Lighter block behind the top-right, as in the reference */
.login-art::before {
  content: "";
  position: absolute;
  z-index: -1;
  top: 0;
  right: 0;
  width: 46%;
  height: 44%;
  background: linear-gradient(200deg, rgb(255 255 255 / 0.35), rgb(255 255 255 / 0));
  border-bottom: 1px solid rgb(18 48 31 / 0.06);
}

.art-stage {
  position: relative;
  height: clamp(220px, 46vh, 500px);
}

.glass {
  position: absolute;
  background: rgb(255 255 255 / 0.7);
  border: 1px solid rgb(255 255 255 / 0.95);
  border-radius: 14px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 20px 50px -34px rgb(18 48 31 / 0.35);
}
.glass svg { display: block; width: 100%; height: auto; overflow: visible; }
.glass svg text { font-family: var(--font); fill: #8a968e; font-size: 12px; font-weight: 300; }
.glass-label { font-size: 13px; font-weight: 300; color: var(--l-mute); }
.glass-value {
  margin-top: 8px;
  font-size: clamp(32px, 3vw, 44px);
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1;
}

.card-a { left: 13%; top: 0; width: 54%; z-index: 2; padding: 22px 26px 24px; }
.card-a svg { margin-top: 10px; }
.card-b { left: 30%; top: 54%; width: 74%; z-index: 1; padding: 14px 0 12px 14px; border-radius: 12px 0 0 12px; border-right: 0; }

.rise { animation: rise 0.9s cubic-bezier(0.22, 0.61, 0.36, 1) both; animation-delay: var(--d, 0s); }
@keyframes rise {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: none; }
}
.draw { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 1.6s cubic-bezier(0.65, 0, 0.35, 1) forwards; animation-delay: var(--d, 0.4s); }
@keyframes draw { to { stroke-dashoffset: 0; } }
.pop { animation: rise 0.5s ease-out both; animation-delay: var(--d, 1.6s); }
@keyframes bob {
  0%, 100% { transform: translateY(0) rotate(-3deg); }
  50% { transform: translateY(-8px) rotate(3deg); }
}

.art-copy {
  max-width: 540px;
  margin: 0 auto;
  padding: 0 32px;
  text-align: center;
}
.art-copy h2 {
  font-size: clamp(24px, 2.1vw, 31px);
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: -0.01em;
}
.art-copy p {
  margin-top: clamp(8px, 2vh, 22px);
  color: #8a968e;
  font-size: clamp(15px, 1.2vw, 18px);
  font-weight: 300;
  line-height: 1.5;
}

/* ---------- Form fields ---------- */

.field { margin-bottom: 16px; }

.field label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 7px;
}

.field input,
.field select {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  font-size: 15px;
  background: var(--cream);
  color: var(--ink);
  transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
}
.field input::placeholder { color: var(--ink-3); }

.field input:focus,
.field select:focus {
  outline: none;
  background: var(--paper);
  border-color: var(--green);
  box-shadow: 0 0 0 4px rgb(23 134 74 / 0.14);
}

.form-error {
  background: var(--danger-l);
  color: var(--danger);
  border-radius: var(--r);
  padding: 11px 14px;
  font-size: 13px;
  margin-bottom: 16px;
}

.form-note {
  font-size: 12px;
  color: var(--ink-3);
  margin-top: 6px;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 18px;
  border: 1.4px solid var(--ink);
  border-radius: var(--r);
  background: transparent;
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}
.btn svg { width: 17px; height: 17px; flex: none; }
.btn:hover { background: var(--ink); color: var(--cream); }

.btn-primary { background: var(--green); border-color: var(--green); color: #fff; }
.btn-primary:hover { background: var(--green-d); border-color: var(--green-d); color: #fff; }

.btn-block { width: 100%; height: 50px; font-size: 15px; }

.btn-secondary { border-color: var(--line-2); background: var(--paper); }
.btn-secondary:hover { border-color: var(--ink); }

.btn-ghost { border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: rgb(16 41 29 / 0.06); color: var(--ink); }

.btn-danger { border-color: transparent; background: var(--danger-l); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }

.btn-sm { height: 34px; padding: 0 12px; font-size: 13px; border-width: 1px; }

.btn:disabled { opacity: 0.6; cursor: progress; }

/* ---------- App shell ---------- */

.app-shell { display: none; min-height: 100vh; }
.app-shell.active { display: flex; }

.sidebar {
  position: sticky;
  top: 0;
  z-index: 40;
  flex: none;
  width: 272px;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 20px 12px 12px;
  border-right: 1px solid var(--line);
  background: var(--paper);
}

.sidebar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 8px 14px;
}
.sidebar-logo img { height: 30px; width: auto; }
.side-toggle { display: none; }

.side-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  margin: 0 -6px;
  padding: 0 6px 8px;
  scrollbar-width: thin;
}

.side-label {
  padding: 0 10px;
  margin: 18px 0 6px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.side-scroll > .side-label:first-child,
.side-scroll > :first-child .side-label:first-child { margin-top: 4px; }
.side-label-row { display: flex; align-items: center; justify-content: space-between; padding-right: 2px; }

.side-nav { display: flex; flex-direction: column; gap: 1px; }

.side-link {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 38px;
  padding: 0 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  text-decoration: none;
  transition: background-color 0.15s, color 0.15s;
}
.side-link svg { width: 18px; height: 18px; flex: none; }
.side-link:hover { background: rgb(16 41 29 / 0.05); color: var(--ink); }
.side-link.active { background: var(--green-l); color: var(--green-d); }
.side-link .tnode-count { margin-left: auto; }

/* Library quick views + folder tree */
.quick-nav, .tree-nav { display: flex; flex-direction: column; gap: 1px; }

.qnode, .tnode-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-width: 0;
  height: 36px;
  padding: 0 10px;
  border: 0;
  border-radius: 9px;
  background: none;
  color: var(--ink-2);
  font-size: 14px;
  text-align: left;
  transition: background-color 0.15s, color 0.15s, box-shadow 0.15s;
}
.qnode svg { width: 18px; height: 18px; flex: none; }
.qnode:hover, .tnode-btn:hover { background: rgb(16 41 29 / 0.05); color: var(--ink); }
.qnode.is-active, .tnode.is-active .tnode-btn { background: var(--green-l); color: var(--green-d); font-weight: 500; }
.tnode-count {
  margin-left: auto;
  padding-left: 6px;
  font-size: 11.5px;
  font-weight: 400;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}
.qnode.is-active .tnode-count, .tnode.is-active .tnode-count { color: var(--green-d); }

.tnode {
  position: relative;
  display: flex;
  align-items: center;
  padding-left: calc(var(--depth, 0) * 14px);
}
.tnode::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(var(--depth, 0) * 14px - 4px);
  width: 1px;
  background: var(--line);
  opacity: min(var(--depth, 0), 1);
}
.twist, .twist-pad { flex: none; width: 22px; height: 28px; }
.twist {
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--ink-3);
}
.twist svg { width: 14px; height: 14px; transition: transform 0.18s; }
.twist.is-open svg { transform: rotate(90deg); }
.twist:hover { color: var(--ink); background: rgb(16 41 29 / 0.06); }
.tnode-btn { padding-left: 4px; gap: 8px; }
.tnode-icon svg { display: block; width: 20px; height: auto; }
.tnode-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-empty { padding: 4px 10px; font-size: 13px; color: var(--ink-3); }

.qnode.drop-hover, .tnode.drop-hover .tnode-btn, .side-link.drop-hover {
  background: var(--green-l);
  color: var(--green-d);
  box-shadow: inset 0 0 0 1.5px var(--green);
}

.icon-btn-xs { width: 24px; height: 24px; border-radius: 6px; }
.icon-btn-xs svg { width: 15px; height: 15px; }

.side-foot {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 12px;
  margin-top: 4px;
  border-top: 1px solid var(--line);
}

.side-storage { padding: 4px 10px 6px; }
.side-storage-top { display: flex; justify-content: space-between; margin-bottom: 7px; font-size: 12px; color: var(--ink-3); }
.side-storage-top strong { color: var(--ink); font-weight: 500; }
.side-storage .storage-bar { height: 5px; margin: 0; }

/* User button + menu */
.user-menu-wrap { position: relative; }
.side-user {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: none;
  text-align: left;
  transition: background-color 0.15s, border-color 0.15s;
}
.side-user:hover, .side-user[aria-expanded="true"] { background: var(--cream); border-color: var(--line); }
.side-user .who { flex: 1; min-width: 0; }
.side-user .who span {
  display: block;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.side-user .who small { display: block; color: var(--ink-3); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user .updown { width: 16px; height: 16px; flex: none; color: var(--ink-3); }

.avatar {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--gold-l);
  color: #6b5513;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
}
.avatar-lg { width: 42px; height: 42px; font-size: 16px; }

.user-menu {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 8px);
  z-index: 60;
  padding: 6px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 24px 60px -24px rgb(16 41 29 / 0.45), 0 2px 6px rgb(16 41 29 / 0.06);
  transform-origin: bottom center;
  animation: pop 0.16s ease-out;
}
@keyframes pop {
  from { opacity: 0; transform: translateY(6px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
.um-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 10px 12px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--line);
}
.um-who { min-width: 0; }
.um-who strong { display: block; font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.um-who span { font-size: 12px; color: var(--ink-3); }
.um-who .um-email { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.um-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 38px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--ink-2);
  font-size: 14px;
  text-align: left;
  text-decoration: none;
}
.um-item svg { width: 18px; height: 18px; flex: none; }
.um-item:hover, .um-item:focus-visible { background: rgb(16 41 29 / 0.05); color: var(--ink); outline: none; }
.um-item.is-danger { color: var(--danger); }
.um-item.is-danger:hover, .um-item.is-danger:focus-visible { background: var(--danger-l); color: var(--danger); }
.user-menu hr, .ctx-menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }

.main-area {
  flex: 1;
  min-width: 0;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 32px clamp(16px, 3.4vw, 48px) 80px;
}

/* Pastel banner at the top of each view */
.banner {
  border-radius: var(--r-lg);
  padding: clamp(24px, 3vw, 36px);
  margin-bottom: 24px;
}
.banner-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}
.banner h1 {
  margin-top: 10px;
  font-size: clamp(28px, 3vw, 42px);
  line-height: 1.04;
  letter-spacing: -0.03em;
}
.banner p { margin-top: 8px; color: var(--ink-2); max-width: 520px; }
.banner-gloss {
  flex: none;
  width: clamp(72px, 9vw, 120px);
  margin: -8px -4px -16px 0;
  animation: bob 5.2s ease-in-out infinite;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 28px;
}
.stat {
  background: rgb(255 253 249 / 0.7);
  border: 1px solid rgb(255 255 255 / 0.8);
  border-radius: 14px;
  padding: 14px 16px;
}
.stat-label { font-size: 12px; color: var(--ink-2); }
.stat-value {
  margin-top: 2px;
  font-size: 26px;
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.stat-value small { white-space: nowrap; font-size: 13px; color: var(--ink-3); letter-spacing: 0; font-weight: 400; }
.stat .storage-bar { margin: 8px 0 0; background: rgb(16 41 29 / 0.1); }

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
}
.page-header h1 { font-size: clamp(26px, 2.6vw, 34px); letter-spacing: -0.03em; }
.page-header p { margin-top: 4px; color: var(--ink-2); }

.breadcrumb { margin-bottom: 14px; }
.breadcrumb button {
  background: none;
  border: none;
  padding: 0;
  color: var(--green-d);
  font-size: 13px;
  font-weight: 500;
}
.breadcrumb button:hover { text-decoration: underline; }

.panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: clamp(18px, 2.4vw, 28px);
  box-shadow: var(--shadow);
}
.panel + .panel { margin-top: 20px; }
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.panel-head h2 { font-size: 18px; }
.panel-narrow { max-width: 460px; }

/* ---------- Org cards (admin) ---------- */

.org-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.org-card {
  border-radius: 18px;
  padding: 20px;
  cursor: pointer;
  border: 1px solid var(--line);
  transition: transform 0.2s, box-shadow 0.2s;
}
.org-card:hover { transform: translateY(-2px); box-shadow: 0 18px 40px -20px rgb(16 41 29 / 0.35); }
.org-card:focus-visible { outline-offset: 3px; }

.org-mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  margin-bottom: 18px;
  background: rgb(255 253 249 / 0.75);
  color: var(--deep);
  font-weight: 600;
  font-size: 15px;
}

.org-card h3 { font-size: 18px; margin-bottom: 2px; }
.org-card .org-meta { font-size: 12px; color: var(--ink-2); margin-bottom: 16px; }

.storage-bar {
  height: 6px;
  border-radius: 4px;
  background: rgb(16 41 29 / 0.1);
  overflow: hidden;
  margin-bottom: 8px;
}
.storage-bar-fill {
  height: 100%;
  background: var(--green);
  border-radius: 4px;
}
.storage-bar-fill.warn { background: var(--gold); }
.storage-bar-fill.danger { background: var(--danger); }

.storage-label {
  font-size: 12px;
  color: var(--ink-2);
  display: flex;
  justify-content: space-between;
}

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 56px 20px;
  color: var(--ink-2);
  border: 1px dashed var(--line-2);
  border-radius: var(--r-lg);
}
.empty-state h3 { color: var(--ink); margin-bottom: 6px; font-size: 18px; }

/* ---------- Tabs ---------- */

.tabs {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  margin-bottom: 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
}
.tab-btn {
  background: none;
  border: none;
  height: 36px;
  padding: 0 16px;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-2);
  transition: background-color 0.2s, color 0.2s;
}
.tab-btn:hover { color: var(--ink); }
.tab-btn.active { background: var(--ink); color: var(--cream); }
.side-nav .tab-btn { height: 42px; padding: 0 12px; }
.side-nav .tab-btn.active { background: var(--green-l); color: var(--green-d); }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ---------- Tables ---------- */

.data-table {
  width: 100%;
  border-collapse: collapse;
}
.data-table th, .data-table td {
  text-align: left;
  padding: 14px 12px;
  font-size: 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.data-table th {
  padding-top: 0;
  color: var(--ink-3);
  font-weight: 500;
  font-size: 12px;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr { transition: background-color 0.15s; }
.data-table tbody tr:hover td { background: rgb(16 41 29 / 0.025); }
.data-table td.actions { text-align: right; white-space: nowrap; }
.data-table td.actions .btn + .btn { margin-left: 6px; }
.data-table .muted { color: var(--ink-3); font-size: 13px; }

.file-cell { display: flex; align-items: center; gap: 12px; min-width: 0; }
.file-cell .name { min-width: 0; overflow-wrap: anywhere; font-weight: 500; }
.file-ext {
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  background: var(--green-l);
  color: var(--green-d);
}
.file-ext.ext-pdf { background: var(--danger-l); color: var(--danger); }
.file-ext.ext-sheet { background: #e2ecca; color: #3f6b17; }
.file-ext.ext-doc { background: var(--gold-l); color: #7d6206; }
.file-ext.ext-img { background: #f8dfcb; color: #9a4a0e; }

.table-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  gap: 12px;
  flex-wrap: wrap;
}

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}
.badge-admin { background: var(--gold-l); color: #6b5513; }
.badge-client { background: var(--green-l); color: var(--green-d); }

/* ---------- Upload dropzone ---------- */

.dropzone {
  display: flex;
  align-items: center;
  gap: 16px;
  border: 1.5px dashed var(--line-2);
  border-radius: 16px;
  padding: 18px 20px;
  margin-bottom: 20px;
  color: var(--ink-2);
  font-size: 14px;
  cursor: pointer;
  background: var(--cream);
  transition: border-color 0.2s, background-color 0.2s;
}
.dropzone:hover { border-color: var(--green); }
.dropzone.drag-over { border-color: var(--green); background: var(--green-l); }
.dropzone input { display: none; }
.dropzone .link { color: var(--green-d); font-weight: 500; text-decoration: underline; text-underline-offset: 3px; }
.dropzone strong { display: block; color: var(--ink); font-weight: 500; }
.dropzone-icon {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--paper);
  border: 1px solid var(--line);
  color: var(--green);
}
.dropzone-icon svg { width: 20px; height: 20px; }

/* ---------- Modal ---------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgb(16 41 29 / 0.42);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.modal {
  background: var(--paper);
  border-radius: var(--r-lg);
  width: 100%;
  max-width: 440px;
  padding: 28px;
  box-shadow: 0 30px 80px -20px rgb(16 41 29 / 0.45);
}

.modal h2 { font-size: 22px; margin-bottom: 20px; }

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
}

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--ink);
  color: var(--cream);
  padding: 12px 18px;
  border-radius: var(--r);
  font-size: 14px;
  box-shadow: 0 16px 40px -12px rgb(16 41 29 / 0.5);
  z-index: 200;
  max-width: 340px;
}
.toast.error { background: var(--danger); color: #fff; }
.toast.success { background: var(--green-d); color: #fff; }

.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgb(255 255 255 / 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.spinner.dark { border-color: rgb(16 41 29 / 0.15); border-top-color: var(--green); }
@keyframes spin { to { transform: rotate(360deg); } }

.loading-row { text-align: center; padding: 40px; color: var(--ink-3); }

/* ---------- File browser (client) ---------- */

.browser-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
}

.crumbs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px;
  min-width: 0;
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.01em;
}
.crumb {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--ink-3);
  font: inherit;
}
.crumb svg { width: 19px; height: 19px; }
button.crumb:hover { background: rgb(16 41 29 / 0.05); color: var(--ink); }
.crumb[aria-current] { color: var(--ink); }
.crumbs .sep { width: 16px; height: 16px; color: var(--ink-3); flex: none; }

.browser-tools { display: flex; align-items: center; gap: 8px; }
.btn-sm svg { width: 16px; height: 16px; }

.view-toggle {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
}
.view-toggle button {
  width: 32px;
  height: 26px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 7px;
  background: none;
  color: var(--ink-3);
}
.view-toggle button:hover { color: var(--ink); }
.view-toggle button[aria-pressed="true"] { background: var(--ink); color: var(--cream); }
.view-toggle svg { width: 16px; height: 16px; }

/* Bar that appears while something is selected */
.select-bar {
  position: sticky;
  top: 12px;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 6px 6px 6px 16px;
  margin-bottom: 14px;
  border-radius: 12px;
  background: var(--ink);
  color: var(--cream);
  box-shadow: 0 16px 34px -18px rgb(16 41 29 / 0.6);
}
.select-bar .count { font-size: 14px; font-weight: 500; }
.select-actions { display: flex; flex-wrap: wrap; gap: 2px; }
.select-actions button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 11px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--cream);
  font-size: 13px;
  font-weight: 500;
}
.select-actions button svg { width: 16px; height: 16px; }
.select-actions button:hover:not(:disabled) { background: rgb(255 255 255 / 0.12); }
.select-actions button:disabled { opacity: 0.38; cursor: not-allowed; }
.select-actions .danger { color: #f5b49f; }

/* Checkbox */
.check {
  appearance: none;
  -webkit-appearance: none;
  flex: none;
  width: 18px;
  height: 18px;
  margin: 0;
  border: 1.5px solid var(--line-2);
  border-radius: 5px;
  background: #fff;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s;
}
.check:hover { border-color: var(--green); }
.check:checked {
  border-color: var(--green);
  background: var(--green) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 6.2 5 8.5l4.5-5' fill='none' stroke='white' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 12px no-repeat;
}
.check:indeterminate {
  border-color: var(--green);
  background: var(--green) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 6h6' stroke='white' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E") center / 12px no-repeat;
}

/* Items: shared cells */
.items .item { position: relative; cursor: default; user-select: none; -webkit-user-select: none; }
.c-check { display: grid; place-items: center; }
.c-icon { display: grid; place-items: center; }
.c-name {
  min-width: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
}
.c-name:hover { color: var(--green-d); text-decoration: underline; text-underline-offset: 3px; }
.c-size, .c-by, .c-date {
  min-width: 0;
  font-size: 13px;
  color: var(--ink-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.c-size { color: var(--ink-2); }
.c-act { display: flex; justify-content: flex-end; }
.icon-btn {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--ink-3);
  transition: opacity 0.15s, background-color 0.15s, color 0.15s;
}
.icon-btn:hover { background: rgb(16 41 29 / 0.07); color: var(--ink); }
.icon-btn svg { width: 17px; height: 17px; }

.items .empty-state { margin-top: 4px; }

/* List view */
.items.list .item,
.items.list .item-head {
  display: grid;
  grid-template-columns: 24px 38px minmax(0, 1fr) 96px minmax(0, 200px) 104px 36px;
  align-items: center;
  gap: 0 12px;
  padding: 9px 10px;
}
.items.list .item-head {
  padding-top: 2px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  color: var(--ink-3);
}
.items.list .item-head .c-name-h { grid-column: 2 / 4; }
.items.list .item { border-radius: 10px; transition: background-color 0.15s; }
.items.list .item + .item { margin-top: 2px; }
.items.list .item:hover { background: rgb(16 41 29 / 0.035); }
.items.list .item.is-selected { background: var(--green-l); }
.items.list .c-icon svg { width: 30px; height: auto; }
.items.list .c-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; justify-self: start; max-width: 100%; }
@media (hover: hover) {
  .items.list .c-act .icon-btn { opacity: 0; }
  .items.list .item:hover .icon-btn,
  .items.list .icon-btn:focus-visible { opacity: 1; }
}

/* Grid view */
.items.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(164px, 1fr));
  gap: 14px;
}
.items.grid .item-head { display: none; }
.items.grid .item {
  display: grid;
  grid-template-rows: 84px auto auto;
  justify-items: center;
  align-content: start;
  gap: 4px;
  padding: 24px 12px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--cream);
  text-align: center;
  transition: border-color 0.15s, box-shadow 0.15s, background-color 0.15s;
}
.items.grid .item:hover { background: var(--paper); border-color: var(--line-2); box-shadow: 0 14px 30px -20px rgb(16 41 29 / 0.4); }
.items.grid .item.is-selected { background: var(--green-l); border-color: var(--green); }
.items.grid .c-check { position: absolute; top: 10px; left: 10px; }
.items.grid .c-act { position: absolute; top: 6px; right: 6px; }
.items.grid .c-icon { width: 100%; height: 84px; }
.items.grid .c-icon svg { width: 76px; height: auto; }
.items.grid .c-icon .file-ext {
  width: 56px;
  height: 70px;
  border-radius: 8px 20px 8px 8px;
  align-content: end;
  padding-bottom: 12px;
  font-size: 12px;
  box-shadow: inset 0 0 0 1px rgb(16 41 29 / 0.05);
}
.items.grid .c-name {
  max-width: 100%;
  margin-top: 6px;
  text-align: center;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: break-word;
}
.items.grid .c-size { font-size: 12px; color: var(--ink-3); }
.items.grid .c-by, .items.grid .c-date { display: none; }
@media (hover: hover) {
  .items.grid:not(.has-selection) .item:not(:hover) .c-check,
  .items.grid .item:not(:hover) .c-act { opacity: 0; }
}

/* Move dialog: folder tree */
.tree {
  max-height: min(50vh, 360px);
  overflow: auto;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--cream);
}
.tree-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px 8px calc(10px + var(--depth, 0) * 20px);
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
}
.tree-row:hover { background: rgb(16 41 29 / 0.05); }
.tree-row:has(input:checked) { background: var(--green-l); color: var(--green-d); font-weight: 500; }
.tree-row input { accent-color: var(--green); margin: 0; }
.tree-row.is-off { opacity: 0.45; cursor: not-allowed; }
.tree-icon { display: grid; place-items: center; width: 22px; }
.tree-icon svg { width: 22px; height: auto; }

/* ---------- Browser: toolbar, search, sort ---------- */

.browser { position: relative; }
.browser .browser-bar { margin-bottom: 12px; }
.browser-tools { flex-wrap: wrap; }

.search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  width: clamp(200px, 22vw, 290px);
  height: 34px;
  padding: 0 8px 0 10px;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: var(--cream);
  color: var(--ink-3);
  transition: border-color 0.15s, box-shadow 0.15s, background-color 0.15s;
}
.search:focus-within { background: #fff; border-color: var(--green); box-shadow: 0 0 0 4px rgb(23 134 74 / 0.1); }
.search > svg { width: 16px; height: 16px; flex: none; }
.search input { flex: 1; min-width: 0; height: 100%; border: 0; background: none; outline: none; font-size: 13.5px; color: var(--ink); }
.search input::placeholder { color: var(--ink-3); }
.search input::-webkit-search-cancel-button { display: none; }
.search kbd {
  padding: 1px 6px;
  border: 1px solid var(--line-2);
  border-radius: 5px;
  background: #fff;
  font: 500 11px var(--font);
  color: var(--ink-3);
}
.search button {
  display: none;
  place-items: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--ink-3);
}
.search button svg { width: 14px; height: 14px; }
.search button:hover { background: rgb(16 41 29 / 0.07); color: var(--ink); }
.search.has-value kbd, .search:focus-within kbd { display: none; }
.search.has-value button { display: grid; }

.crumb-clear {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 26px;
  margin-left: 6px;
  padding: 0 10px 0 6px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--paper);
  font-size: 12px;
  color: var(--ink-2);
}
.crumb-clear svg { width: 13px; height: 13px; }
.crumb-clear:hover { border-color: var(--line-2); color: var(--ink); }
.crumb.drop-hover { background: var(--green-l); color: var(--green-d); box-shadow: inset 0 0 0 1.5px var(--green); }
.crumbs .sep { display: inline-flex; color: var(--ink-3); }
.crumbs .sep svg { width: 16px; height: 16px; }

.browser-sub {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0 12px;
  border-top: 1px solid var(--line);
}
.items-meta { font-size: 12.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.browser-sub-tools { display: flex; align-items: center; gap: 10px; }
.sort-pick { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-3); }
.sort-pick select {
  appearance: none;
  -webkit-appearance: none;
  height: 30px;
  padding: 0 28px 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236d776f' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") right 8px center / 13px no-repeat;
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
}
.sort-pick select:hover { border-color: var(--line-2); }

.select-bar .count { display: inline-flex; align-items: baseline; gap: 8px; }
.select-bar .count strong { font-weight: 500; font-size: 14px; }
.select-bar .count span { font-size: 12.5px; opacity: 0.6; }
.select-actions { align-items: center; }
.select-sep { width: 1px; height: 18px; margin: 0 4px; background: rgb(255 255 255 / 0.2); }

/* Names, paths, tags */
.c-main { min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; }
.c-path {
  display: flex;
  align-items: center;
  gap: 5px;
  width: 100%;
  min-width: 0;
  font-size: 12px;
  color: var(--ink-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.c-path svg { width: 13px; height: 13px; flex: none; }
.tag-new {
  flex: none;
  padding: 1px 7px;
  border-radius: 20px;
  background: var(--gold-l);
  color: #6b5513;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.items.list .item,
.items.list .item-head { grid-template-columns: 24px 38px minmax(0, 1fr) 96px minmax(0, 180px) 104px 72px; }
.items.list .c-act { gap: 2px; }
.items.grid .c-main { flex-direction: column; justify-content: center; gap: 4px; max-width: 100%; }
.items.grid .c-path { justify-content: center; }
.items.grid .c-act [data-download-key] { display: none; }

.sort-h {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: inherit;
  cursor: pointer;
}
.sort-h:hover, .sort-h.is-on { color: var(--ink); }
.sort-arrow { display: inline-block; min-width: 10px; }

/* Drag & drop */
.item.is-dragging { opacity: 0.4; }
.items .item.drop-hover { background: var(--green-l); box-shadow: inset 0 0 0 1.5px var(--green); }
.items.grid .item.drop-hover { border-color: var(--green); }
.drag-ghost {
  position: fixed;
  top: -200px;
  left: -400px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  max-width: 280px;
  padding: 8px 14px 8px 8px;
  border-radius: 10px;
  background: var(--ink);
  color: var(--cream);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}
.drag-ghost > svg { width: 26px; height: auto; }
.drag-ghost .file-ext { width: 28px; height: 28px; font-size: 9px; }
.drag-ghost span:last-child { overflow: hidden; text-overflow: ellipsis; }

.drop-overlay {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: grid;
  place-items: center;
  border: 2px dashed var(--green);
  border-radius: inherit;
  background: rgb(229 240 232 / 0.88);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
}
.browser.is-dropping .drop-overlay { opacity: 1; }
.drop-card { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; color: var(--green-d); }
.drop-icon {
  display: grid;
  place-items: center;
  width: 60px;
  height: 60px;
  margin-bottom: 6px;
  border-radius: 18px;
  background: #fff;
  box-shadow: var(--shadow);
  animation: bob 2.4s ease-in-out infinite;
}
.drop-icon svg { width: 26px; height: 26px; }
.drop-card strong { font-size: 19px; font-weight: 500; color: var(--ink); }
.drop-card span { font-size: 13.5px; }

/* Loading + empty */
.skeleton { display: grid; gap: 4px; padding: 6px 0; }
.sk-row { display: grid; grid-template-columns: 36px minmax(0, 1fr) 120px; align-items: center; gap: 14px; padding: 10px; }
.sk-row span {
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(90deg, rgb(16 41 29 / 0.05), rgb(16 41 29 / 0.11), rgb(16 41 29 / 0.05));
  background-size: 200% 100%;
  animation: shimmer 1.2s linear infinite;
}
.sk-row span:first-child { height: 36px; border-radius: 9px; }
.sk-row span:nth-child(2) { width: 60%; }
@keyframes shimmer { to { background-position: -200% 0; } }

.empty-rich {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 52px 20px;
  background: var(--cream);
}
.empty-art svg { width: 76px; height: auto; margin-bottom: 8px; }
.empty-rich p { max-width: 380px; }
.empty-rich .btn { margin-top: 14px; }

/* ---------- Buttons (extra) ---------- */

.btn-danger-solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger-solid:hover { background: #963520; border-color: #963520; color: #fff; }
.btn-ghost-danger { background: var(--paper); border-color: var(--line-2); color: var(--danger); }
.btn-ghost-danger:hover { background: var(--danger-l); border-color: var(--danger); color: var(--danger); }
.btn-ghost-danger svg { width: 18px; height: 18px; }

/* ---------- Overlays ---------- */

body.no-scroll { overflow: hidden; }
.modal { animation: pop 0.18s ease-out; }
.modal-sub { margin: -12px 0 18px; color: var(--ink-2); font-size: 14px; }
.modal-confirm { max-width: 420px; }
.modal-confirm h2 { margin-bottom: 16px; }
.modal-confirm .modal-sub { margin: -8px 0 0; line-height: 1.5; }
.confirm-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  margin-bottom: 16px;
  border-radius: 14px;
  background: var(--danger-l);
  color: var(--danger);
}
.confirm-icon svg { width: 22px; height: 22px; }
.tree-here { margin-left: auto; padding: 2px 8px; border-radius: 20px; background: rgb(16 41 29 / 0.06); font-size: 11px; color: var(--ink-3); }

/* Context menu */
.ctx-menu {
  position: fixed;
  z-index: 150;
  min-width: 228px;
  max-width: 290px;
  padding: 6px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 24px 60px -20px rgb(16 41 29 / 0.45), 0 2px 6px rgb(16 41 29 / 0.06);
  animation: pop 0.12s ease-out;
}
.ctx-head { padding: 6px 10px 8px; font-size: 12px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ctx-menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 34px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: none;
  font-size: 13.5px;
  color: var(--ink);
  text-align: left;
}
.ctx-menu button svg { width: 17px; height: 17px; flex: none; color: var(--ink-3); }
.ctx-menu button:hover:not(:disabled), .ctx-menu button:focus-visible { background: rgb(16 41 29 / 0.05); outline: none; }
.ctx-menu button:disabled { opacity: 0.4; cursor: not-allowed; }
.ctx-menu .is-danger, .ctx-menu .is-danger svg { color: var(--danger); }
.ctx-menu kbd {
  margin-left: auto;
  padding: 1px 5px;
  border: 1px solid var(--line);
  border-radius: 4px;
  font: 500 10.5px var(--font);
  color: var(--ink-3);
}

/* Viewer (full screen, view only) */
.viewer {
  --v-bg: #0f1f17;
  --v-bar: #10291d;
  --v-line: rgb(255 255 255 / 0.08);
  --v-text: #e9efe9;
  --v-mute: rgb(233 239 233 / 0.62);
  position: fixed;
  inset: 0;
  z-index: 110;
  display: flex;
  flex-direction: column;
  background: var(--v-bg);
  color: var(--v-text);
  animation: fade 0.18s ease-out;
}
.viewer[hidden] { display: none; }
.viewer-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 62px;
  padding: 8px 14px;
  background: var(--v-bar);
  border-bottom: 1px solid var(--v-line);
}
.vbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 36px;
  min-width: 36px;
  padding: 0 9px;
  border: 0;
  border-radius: 9px;
  background: none;
  color: var(--v-mute);
  font-size: 13.5px;
  white-space: nowrap;
  transition: background-color 0.15s, color 0.15s;
}
.vbtn svg { width: 18px; height: 18px; flex: none; }
.vbtn:hover:not(:disabled) { background: rgb(255 255 255 / 0.08); color: #fff; }
.vbtn:disabled { opacity: 0.28; cursor: default; }
.vbtn[aria-pressed="true"] { background: rgb(255 255 255 / 0.13); color: #fff; }
.vbtn:focus-visible { outline: 2px solid #7fd3a2; outline-offset: 1px; }
.viewer-badge .file-ext { width: 36px; height: 36px; }
.viewer-title { flex: 1; min-width: 0; }
.viewer-title h2 { font-size: 15px; font-weight: 500; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -0.01em; }
.viewer-title p { margin-top: 1px; font-size: 12px; color: var(--v-mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.viewer-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
  height: 26px;
  padding: 0 10px;
  border-radius: 20px;
  background: rgb(255 255 255 / 0.08);
  font-size: 12px;
  color: var(--v-mute);
}
.viewer-pill svg { width: 14px; height: 14px; }
.viewer-nav { display: flex; align-items: center; gap: 2px; flex: none; font-size: 12.5px; color: var(--v-mute); font-variant-numeric: tabular-nums; }
#viewer-pos { min-width: 50px; text-align: center; }
#viewer-pos:empty { min-width: 0; }
.viewer-actions { display: flex; align-items: center; gap: 2px; flex: none; padding-left: 8px; margin-left: 2px; border-left: 1px solid var(--v-line); }
.viewer-actions .btn { margin-left: 8px; border-width: 1px; }
.viewer-main { flex: 1; min-height: 0; display: flex; }
.viewer-stage { position: relative; flex: 1; min-width: 0; overflow: auto; outline: none; scrollbar-color: rgb(255 255 255 / 0.25) transparent; }
.viewer-info {
  flex: none;
  width: 300px;
  overflow: auto;
  padding: 22px 20px;
  background: var(--paper);
  color: var(--ink);
  animation: slide-in 0.2s ease-out;
}
.viewer-info h3 { margin-bottom: 16px; font-size: 14px; }
.viewer-info .details { grid-template-columns: 1fr; }
.viewer-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 50px;
  padding: 6px 14px;
  background: var(--v-bar);
  border-top: 1px solid var(--v-line);
  font-size: 12.5px;
  color: var(--v-mute);
}
.viewer-foot[hidden] { display: none; }
.vf-left, .vf-right { display: flex; align-items: center; gap: 12px; min-width: 0; }
.vf-left { flex: 1; }
.vf-info { white-space: nowrap; font-variant-numeric: tabular-nums; }
.zoom-group { display: inline-flex; align-items: center; gap: 2px; padding: 2px; border-radius: 10px; background: rgb(255 255 255 / 0.06); }
.zoom-group .vbtn { height: 30px; min-width: 30px; padding: 0 6px; }
.zoom-val { min-width: 54px !important; font-variant-numeric: tabular-nums; }
.sheet-tabs { display: flex; gap: 2px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.sheet-tab {
  flex: none;
  height: 32px;
  padding: 0 14px;
  border: 0;
  border-radius: 8px;
  background: none;
  font-size: 13px;
  color: var(--v-mute);
  white-space: nowrap;
}
.sheet-tab:hover { background: rgb(255 255 255 / 0.08); color: #fff; }
.sheet-tab[aria-selected="true"] { background: #fff; color: var(--ink); font-weight: 500; }

.viewer-loading, .viewer-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px;
  text-align: center;
  color: var(--v-mute);
}
.viewer-loading .file-ext, .viewer-empty .file-ext {
  width: 68px;
  height: 84px;
  margin-bottom: 6px;
  padding-bottom: 14px;
  border-radius: 10px 24px 10px 10px;
  align-content: end;
  font-size: 14px;
}
.viewer-loading .file-ext { animation: bob 2s ease-in-out infinite; }
.viewer-loading .spinner { border-color: rgb(255 255 255 / 0.2); border-top-color: #fff; }
.viewer-loading p { font-size: 13.5px; }
.viewer-empty p { max-width: 420px; font-size: 17px; font-weight: 500; color: #fff; }
.viewer-empty span { max-width: 420px; font-size: 13.5px; }
.viewer-empty .btn { margin-top: 12px; border-width: 1px; }
.viewer-empty.is-inline { position: static; padding: 80px 24px; }

/* PDF */
.pdf-pages { display: flex; flex-direction: column; align-items: center; gap: 22px; padding: 28px 24px 56px; width: fit-content; min-width: 100%; }
.pdf-page { position: relative; flex: none; background: #fff; border-radius: 2px; box-shadow: 0 12px 40px -12px rgb(0 0 0 / 0.65); }
.pdf-page canvas { display: block; width: 100%; height: 100%; }
.pdf-page[data-loading]::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, #f3f5f3, #e8ece9, #f3f5f3);
  background-size: 200% 100%;
  animation: shimmer 1.2s linear infinite;
}
.page-no { position: absolute; right: -40px; bottom: 0; font-size: 11px; color: var(--v-mute); }

/* Word */
.docx-host { display: flex; justify-content: center; padding: 28px 24px 56px; width: fit-content; min-width: 100%; }
.docx-host .docx-wrapper { background: transparent !important; padding: 0 !important; gap: 22px; }
.docx-host .docx-wrapper > section.docx { margin: 0 !important; border-radius: 2px; box-shadow: 0 12px 40px -12px rgb(0 0 0 / 0.65) !important; }

/* Excel */
.viewer-stage.is-sheet { background: #f6f8f6; }
table.sheet {
  border-collapse: separate;
  border-spacing: 0;
  background: #fff;
  color: #1d2b22;
  font: 13px/1.4 var(--font);
}
.sheet th, .sheet td {
  max-width: 420px;
  padding: 5px 10px;
  border-right: 1px solid #e3e8e4;
  border-bottom: 1px solid #e3e8e4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
  vertical-align: bottom;
}
.sheet thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #eef2ef;
  color: #6d776f;
  font-size: 11.5px;
  font-weight: 500;
  text-align: center;
}
.sheet tbody th {
  position: sticky;
  left: 0;
  z-index: 1;
  min-width: 46px;
  background: #eef2ef;
  color: #6d776f;
  font-size: 11.5px;
  font-weight: 500;
  text-align: center;
}
.sheet thead th.corner { left: 0; z-index: 3; }
.sheet td.num { text-align: right; font-variant-numeric: tabular-nums; }
.sheet td.bool { text-align: center; }
.sheet td.err { color: var(--danger); }
.sheet tbody tr:hover td { background: #f6faf7; }
.sheet-note { padding: 14px 20px; font-size: 12.5px; color: var(--ink-3); }

/* PowerPoint */
.slides-host { display: flex; justify-content: center; padding: 28px 24px 56px; }
.slides-host > div { background: transparent !important; }
.slides-host .pptx-preview-slide-wrapper { margin: 0 auto 22px !important; box-shadow: 0 12px 40px -12px rgb(0 0 0 / 0.65); border-radius: 2px; overflow: hidden; }

/* Images & text */
.img-stage { display: grid; place-items: center; min-height: 100%; padding: 24px; }
.img-stage img { max-width: 100%; max-height: calc(100vh - 180px); border-radius: 4px; box-shadow: 0 12px 40px -12px rgb(0 0 0 / 0.65); cursor: zoom-in; background: repeating-conic-gradient(#f2f2f2 0 25%, #fff 0 50%) 0 0 / 16px 16px; }
.text-stage { padding: 28px 24px 56px; }
.text-stage pre {
  max-width: 980px;
  margin: 0 auto;
  padding: 28px 32px;
  border-radius: 4px;
  background: #fff;
  color: var(--ink);
  font: 13px/1.65 ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* Dialogs and menus sit above the viewer. */
.modal-backdrop { z-index: 160; }
.ctx-menu { z-index: 170; }

/* Upload tray */
.upload-tray {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 90;
  width: min(380px, calc(100vw - 32px));
  overflow: hidden;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 30px 70px -24px rgb(16 41 29 / 0.5);
  animation: pop 0.2s ease-out;
}
.tray-head { display: flex; align-items: center; gap: 4px; padding: 12px 10px 12px 16px; background: var(--ink); color: var(--cream); }
.tray-head > div { flex: 1; min-width: 0; }
.tray-head strong { display: block; font-size: 14px; font-weight: 500; }
.tray-head span { font-size: 12px; opacity: 0.65; }
.tray-head .icon-btn { color: var(--cream); }
.tray-head .icon-btn:hover { background: rgb(255 255 255 / 0.12); color: #fff; }
.tray-head [data-tray="collapse"] svg { transform: rotate(90deg); transition: transform 0.2s; }
.upload-tray.is-collapsed [data-tray="collapse"] svg { transform: rotate(-90deg); }
.tray-bar { height: 3px; background: rgb(16 41 29 / 0.08); }
.tray-bar span { display: block; height: 100%; background: var(--green); transition: width 0.2s; }
.tray-list { list-style: none; margin: 0; padding: 6px; max-height: 280px; overflow: auto; }
.upload-tray.is-collapsed .tray-list { display: none; }
.tray-item { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 10px; }
.tray-item .file-ext { flex: none; width: 32px; height: 32px; font-size: 9px; }
.tray-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.tray-name { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tray-meta { font-size: 11.5px; color: var(--ink-3); }
.tray-item.is-error .tray-meta { color: var(--danger); }
.tray-progress { height: 4px; margin-top: 3px; overflow: hidden; border-radius: 4px; background: rgb(16 41 29 / 0.08); }
.tray-progress span { display: block; height: 100%; border-radius: 4px; background: var(--green); transition: width 0.15s; }
.tray-state { flex: none; display: grid; place-items: center; width: 22px; height: 22px; }
.tray-state svg { width: 18px; height: 18px; }
.tray-item.is-done .tray-state { color: var(--green); }
.tray-item.is-error .tray-state { color: var(--danger); }

.toast { left: 50%; right: auto; transform: translateX(-50%); }

/* ---------- Account page ---------- */

.page-head { margin-bottom: 22px; }
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 500;
  color: var(--green-d);
  text-decoration: none;
}
.back-link svg { width: 16px; height: 16px; }
.back-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.page-head h1 { font-size: clamp(28px, 3vw, 40px); line-height: 1.05; letter-spacing: -0.03em; }
.page-head p { margin-top: 8px; color: var(--ink-2); }

.acc-hero {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 22px;
  margin-bottom: 20px;
  padding: clamp(20px, 2.6vw, 30px);
  border-radius: var(--r-lg);
}
.acc-avatar {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: var(--paper);
  color: var(--green-d);
  font-size: 30px;
  font-weight: 500;
  box-shadow: 0 0 0 6px rgb(255 255 255 / 0.5), 0 18px 40px -18px rgb(16 41 29 / 0.4);
}
.acc-id h2 { font-size: clamp(20px, 2vw, 26px); letter-spacing: -0.02em; overflow-wrap: anywhere; }
.acc-id p { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 8px; font-size: 14px; color: var(--ink-2); }
.acc-facts {
  display: grid;
  grid-template-columns: repeat(3, auto);
  gap: 6px 28px;
  margin: 0;
  padding: 14px 20px;
  border: 1px solid rgb(255 255 255 / 0.85);
  border-radius: 14px;
  background: rgb(255 253 249 / 0.72);
}
.acc-facts dt { font-size: 11.5px; color: var(--ink-3); }
.acc-facts dd { margin: 2px 0 0; font-size: 14px; font-weight: 500; white-space: nowrap; }

.acc-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.acc-side { display: grid; gap: 20px; }
.acc-side .panel + .panel { margin-top: 0; }
.acc-head { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 22px; }
.acc-head h2 { font-size: 18px; }
.acc-head p { margin-top: 3px; font-size: 13.5px; color: var(--ink-2); }
.acc-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--green-l);
  color: var(--green-d);
}
.acc-icon svg { width: 20px; height: 20px; }

.pw-form .field input { background: #fff; }
.pw-meter { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.pw-bars { flex: 1; display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; }
.pw-bars span { height: 5px; border-radius: 4px; background: rgb(16 41 29 / 0.1); transition: background-color 0.2s; }
.pw-label { min-width: 128px; font-size: 12.5px; color: var(--ink-3); text-align: right; }
.pw-meter[data-level="1"] .pw-bars span:nth-child(-n + 1) { background: var(--danger); }
.pw-meter[data-level="2"] .pw-bars span:nth-child(-n + 2) { background: var(--orange); }
.pw-meter[data-level="3"] .pw-bars span:nth-child(-n + 3) { background: var(--gold); }
.pw-meter[data-level="4"] .pw-bars span { background: var(--green); }
.pw-meter[data-level="1"] .pw-label { color: var(--danger); }
.pw-meter[data-level="2"] .pw-label { color: #b25c17; }
.pw-meter[data-level="3"] .pw-label { color: #7d6206; }
.pw-meter[data-level="4"] .pw-label { color: var(--green-d); }
.pw-rules { list-style: none; display: grid; grid-template-columns: 1fr 1fr; gap: 7px 14px; margin: 14px 0 0; padding: 0; }
.pw-rules li { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-3); transition: color 0.15s; }
.rule-dot { flex: none; width: 16px; height: 16px; border: 1.5px solid var(--line-2); border-radius: 50%; transition: all 0.15s; }
.pw-rules li.ok { color: var(--green-d); }
.pw-rules li.ok .rule-dot {
  border-color: var(--green);
  background: var(--green) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 6.2 5 8.5l4.5-5' fill='none' stroke='white' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 10px no-repeat;
}
.pw-match { display: block; margin-top: 8px; font-size: 12.5px; }
.pw-match.ok { color: var(--green-d); }
.pw-match.bad { color: var(--ink-3); }
.pw-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 14px; margin-top: 24px; }
.pw-actions .form-note { flex: 1 1 200px; margin: 0; }

.donut-wrap { position: relative; width: 184px; margin: 0 auto 18px; }
.donut { display: block; width: 100%; height: auto; }
.donut circle { transition: stroke-dasharray 0.6s; }
.donut-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.donut-center strong { font-size: 30px; font-weight: 500; letter-spacing: -0.03em; line-height: 1; }
.donut-center span { max-width: 110px; margin-top: 5px; font-size: 11.5px; color: var(--ink-3); }
.legend-list { list-style: none; display: grid; margin: 0; padding: 0; }
.legend-list li {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  padding: 8px 4px;
  border-top: 1px solid var(--line);
  font-size: 13.5px;
}
.legend-list li:first-child { border-top: 0; }
.legend-list .sw { width: 10px; height: 10px; border-radius: 3px; }
.legend-list small { font-size: 12px; color: var(--ink-3); }
.legend-list strong { min-width: 64px; font-weight: 500; text-align: right; font-variant-numeric: tabular-nums; }
.legend-list .legend-empty { display: block; color: var(--ink-3); }

.contact-list { display: grid; gap: 8px; }
.contact-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  text-decoration: none;
  transition: border-color 0.15s, background-color 0.15s;
}
.contact-row:hover { border-color: var(--green); background: var(--green-l); }
.contact-row > span:last-child { min-width: 0; }
.contact-row strong { display: block; font-size: 14px; font-weight: 500; }
.contact-row small { display: block; font-size: 12px; color: var(--ink-3); overflow-wrap: anywhere; }
.contact-ic { flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--cream); color: var(--green-d); }
.contact-ic svg { width: 18px; height: 18px; }
.contact-ic.is-wa { background: #e3f3e8; color: var(--green); }

/* ---------- Responsive ---------- */

@media (max-width: 1000px) {
  /* Form only on smaller screens */
  .login-art { display: none; }
  .login-side { max-width: 560px; margin: 0 auto; }
}

@media (max-width: 1000px) {
  .acc-grid { grid-template-columns: 1fr; }
  .acc-hero { grid-template-columns: auto minmax(0, 1fr); }
  .acc-facts { grid-column: 1 / -1; }
}

@media (max-width: 900px) {
  .app-shell.active { flex-direction: column; }
  .sidebar {
    z-index: 50;
    width: 100%;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    padding: 10px 12px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    background: rgb(255 253 249 / 0.94);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }
  .sidebar-top { flex: 1; justify-content: flex-start; gap: 6px; padding: 0; }
  .side-toggle { display: grid; order: -1; color: var(--ink); }
  .sidebar-logo img { height: 26px; }
  .side-foot { flex-direction: row; align-items: center; gap: 8px; margin: 0; padding: 0; border: 0; }
  .side-storage { display: none; }
  .side-user { padding: 4px; }
  .side-user .who, .side-user .updown { display: none; }
  .user-menu { left: auto; right: 0; top: calc(100% + 8px); bottom: auto; width: 270px; transform-origin: top right; }
  .side-scroll {
    display: none;
    order: 5;
    flex: none;
    width: calc(100% + 12px);
    max-height: 62vh;
    margin: 10px -6px 0;
    padding: 4px 6px 8px;
    border-top: 1px solid var(--line);
  }
  body.side-open .side-scroll { display: block; }
  .main-area { padding-top: 20px; }
}

@media (max-width: 640px) {
  .login-shell { padding: 12px; }
  .login-side { padding: 20px; }
  .login-card { padding: 56px 0 24px; }
  .login-logo { top: 18px; left: 20px; }
  .login-brand { margin-bottom: 32px; }
  .alt-actions { margin-top: 36px; }

  .banner-top { flex-wrap: wrap; }
  .banner-top > div:first-child { flex: 1 1 200px; }
  .banner-gloss { width: 64px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 22px; }
  .stat { padding: 12px 14px; }
  .stat:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .stat-value { font-size: 22px; }

  .browser-tools { width: 100%; }
  .browser-tools .search { width: 100%; }
  .browser-tools .btn { flex: 1; }
  .search kbd { display: none; }
  .sort-pick > span { display: none; }
  .select-bar { padding-left: 12px; }
  .select-actions button { padding: 0 8px; }
  .select-actions button span { display: none; }

  .items.list .item-head { display: none; }
  .items.list .item {
    grid-template-columns: 24px 38px minmax(0, 1fr) 36px !important;
    grid-template-areas: "check icon name act" "check icon size act";
    gap: 0 10px;
  }
  .items.list .c-check { grid-area: check; }
  .items.list .c-icon { grid-area: icon; }
  .items.list .c-main { grid-area: name; }
  .items.list .c-act [data-download-key] { display: none; }
  .items.list .c-size { grid-area: size; font-size: 12px; color: var(--ink-3); }
  .items.list .c-by, .items.list .c-date { display: none; }
  .items.list .c-act { grid-area: act; }
  .items.grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }

  /* Tables become stacked cards */
  .data-table thead { display: none; }
  .data-table, .data-table tbody, .data-table tr, .data-table td { display: block; width: 100%; }
  .data-table tr { padding: 14px 0; border-bottom: 1px solid var(--line); }
  .data-table tbody tr:last-child { border-bottom: 0; }
  .data-table td { border: 0; padding: 3px 0; }
  .data-table td[data-label]:not(:first-child) { display: inline-block; width: auto; margin-right: 14px; }
  .data-table td:first-child { padding-bottom: 6px; }
  .data-table td[data-label]:not(:first-child)::before {
    content: attr(data-label) " · ";
    color: var(--ink-3);
    font-size: 12px;
  }
  .data-table td.actions { text-align: left; padding-top: 10px; }
  .data-table tbody tr:hover td { background: none; }

  .toast { left: 16px; right: 16px; bottom: 16px; max-width: none; transform: none; }
  .viewer-bar { gap: 4px; padding: 6px 8px; min-height: 56px; flex-wrap: wrap; }
  .viewer-badge, .viewer-pill, .vbtn-label span, .viewer-actions .btn span { display: none; }
  .viewer-actions { border: 0; padding: 0; margin: 0; }
  .viewer-actions .btn { margin-left: 4px; padding: 0 10px; }
  .viewer-nav #viewer-pos { min-width: 0; }
  .viewer-info { position: absolute; inset: 56px 0 0; z-index: 2; width: auto; }
  .pdf-pages, .docx-host, .slides-host, .text-stage { padding: 16px 12px 40px; }
  .page-no { display: none; }
  .upload-tray { right: 16px; bottom: 16px; }
  .details { grid-template-columns: 1fr; }
  .acc-hero { grid-template-columns: 1fr; text-align: left; }
  .acc-facts { grid-template-columns: 1fr 1fr; }
  .pw-rules { grid-template-columns: 1fr; }
  .pw-label { min-width: 0; }
}

@media (max-height: 560px) {
  .login-shell { height: auto; min-height: 100svh; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Admin sidebar: open organization ---------- */

.side-org {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 0 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--cream);
}
.side-org small { display: block; font-size: 11px; color: var(--ink-3); }
.side-org strong { display: block; font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-org > div { min-width: 0; }
.org-chip {
  flex: none;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  color: var(--deep);
  font-size: 12.5px;
  font-weight: 600;
}
.modal-wide { max-width: 560px; max-height: calc(100vh - 40px); overflow: auto; }
.modal-wide .acc-head { position: relative; padding-right: 40px; }
.modal-x { position: absolute; top: -6px; right: -6px; }

/* On the account page nothing in the library is "current". */
.on-account .qnode.is-active,
.on-account .tnode.is-active .tnode-btn { background: none; color: var(--ink-2); font-weight: 400; }
.on-account .qnode.is-active .tnode-count,
.on-account .tnode.is-active .tnode-count { color: var(--ink-3); }

/* Details list (viewer side panel) */
.details { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 20px; margin: 0; }
.details div { min-width: 0; }
.details dt { font-size: 12px; color: var(--ink-3); }
.details dd { margin: 3px 0 0; font-size: 14px; overflow-wrap: anywhere; }
.link-btn {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: var(--green-d);
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

/* Storage notices — one style per level (logarithmic: ¼, ⅛, 1/16 left, full) */
.storage-alert {
  --sa-bg: #eef5f0; --sa-line: #cfe3d6; --sa-ink: #0f6b3a; --sa-fill: var(--green);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 0 0 14px;
  padding: 14px 16px;
  border: 1px solid var(--sa-line);
  border-radius: 14px;
  background: var(--sa-bg);
  color: var(--ink-2);
  font-size: 13.5px;
}
.storage-alert.lvl-warn { --sa-bg: #fbf3d9; --sa-line: #ecd58c; --sa-ink: #6b5513; --sa-fill: var(--gold); }
.storage-alert.lvl-critical { --sa-bg: #fcebdc; --sa-line: #f2c39c; --sa-ink: #9a4a0e; --sa-fill: var(--orange); }
.storage-alert.lvl-full { --sa-bg: var(--danger-l); --sa-line: #ecb7a6; --sa-ink: var(--danger); --sa-fill: var(--danger); }
.storage-alert > svg { flex: none; width: 20px; height: 20px; margin-top: 1px; color: var(--sa-ink); }
.sa-main { flex: 1; min-width: 0; }
.sa-main strong { display: block; margin-bottom: 2px; font-weight: 500; color: var(--sa-ink); }
.sa-meter { position: relative; height: 6px; margin-top: 10px; border-radius: 4px; background: rgb(16 41 29 / 0.1); }
.sa-fill { position: absolute; inset: 0 auto 0 0; border-radius: 4px; background: var(--sa-fill); }
.sa-meter i { position: absolute; top: -3px; bottom: -3px; width: 2px; margin-left: -1px; border-radius: 2px; background: var(--paper); opacity: 0.9; }
.sa-actions { display: flex; align-items: center; gap: 10px; flex: none; align-self: center; }
.sa-actions:empty { display: none; }
.sa-link { font-size: 13px; font-weight: 500; color: var(--sa-ink); text-underline-offset: 3px; }
.sa-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 12px;
  border-radius: 20px;
  background: rgb(255 255 255 / 0.7);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--green-d);
  white-space: nowrap;
}
.sa-chip svg { width: 14px; height: 14px; }
.badge-over { margin-left: 6px; background: var(--danger-l); color: var(--danger); font-size: 11px; padding: 2px 8px; }
.form-note.is-warn { color: var(--danger); }
#upload-btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* Dialog icon variants */
.confirm-icon.is-info { background: var(--gold-l); color: #7d6206; }
.confirm-icon.is-ok { background: var(--green-l); color: var(--green-d); }

/* Duplicate names on upload */
.modal-dupe { max-width: 620px; max-height: calc(100vh - 40px); display: flex; flex-direction: column; }
.modal-dupe .modal-sub { margin-top: -8px; }
.dupe-all {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
  font-size: 12.5px;
  color: var(--ink-3);
}
.dupe-all > span { margin-right: 4px; }
.dupe-all button {
  height: 28px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--paper);
  font-size: 12.5px;
  color: var(--ink-2);
}
.dupe-all button:hover { border-color: var(--green); color: var(--green-d); }
.dupe-list { list-style: none; margin: 0; padding: 0; overflow: auto; min-height: 0; border: 1px solid var(--line); border-radius: 14px; }
.dupe-row { display: grid; gap: 10px; padding: 14px 16px; }
.dupe-row + .dupe-row { border-top: 1px solid var(--line); }
.dupe-file { display: flex; align-items: center; gap: 12px; min-width: 0; }
.dupe-file > div { min-width: 0; }
.dupe-file strong { display: block; font-size: 14px; font-weight: 500; overflow-wrap: anywhere; }
.dupe-file small { display: block; font-size: 12px; color: var(--ink-3); }
.seg-group { display: inline-flex; width: fit-content; padding: 3px; border-radius: 10px; background: rgb(16 41 29 / 0.06); }
.seg { position: relative; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span {
  display: inline-flex;
  align-items: center;
  height: 30px;
  padding: 0 14px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--ink-2);
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s, box-shadow 0.15s;
}
.seg input:checked + span { background: var(--paper); color: var(--ink); font-weight: 500; box-shadow: 0 1px 3px rgb(16 41 29 / 0.15); }
.seg input:focus-visible + span { outline: 2px solid var(--green); outline-offset: 1px; }
.seg.is-off span { opacity: 0.4; cursor: not-allowed; }
.dupe-result { font-size: 12.5px; color: var(--ink-2); }
.dupe-result b { font-weight: 500; color: var(--green-d); }
.dupe-result.is-replace { color: #9a4a0e; }
.dupe-result.is-skip { color: var(--ink-3); }
.dupe-why { display: block; margin-top: 2px; color: var(--ink-3); }

/* Storage warning + request dialog */
.modal-space { max-width: 460px; }
.space-gauge { position: relative; width: 120px; margin: 4px auto 18px; }
.space-gauge svg { display: block; width: 100%; height: auto; }
.space-gauge svg circle { transition: stroke-dasharray 0.8s cubic-bezier(0.22, 0.61, 0.36, 1); }
.space-gauge > div { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.space-gauge strong { font-size: 26px; font-weight: 500; letter-spacing: -0.03em; line-height: 1; }
.space-gauge span { margin-top: 3px; font-size: 11.5px; color: var(--ink-3); }
.space-step[data-step="warn"] h2, .space-step[data-step="warn"] .modal-sub,
.space-step[data-step="sent"] { text-align: center; }
.space-step[data-step="warn"] .modal-sub { margin-top: -6px; line-height: 1.55; }
.space-step[data-step="sent"] .confirm-icon { margin: 0 auto 14px; }
.space-step[data-step="sent"] .modal-actions,
.space-step[data-step="warn"] .modal-actions { justify-content: center; }
.field-label { display: block; margin-bottom: 8px; font-size: 13px; font-weight: 500; }
.optional { font-weight: 400; color: var(--ink-3); }
.chip-group { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span {
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 0 16px;
  border: 1px solid var(--line-2);
  border-radius: 20px;
  background: var(--paper);
  font-size: 13.5px;
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s, color 0.15s;
}
.chip input:checked + span { border-color: var(--green); background: var(--green-l); color: var(--green-d); font-weight: 500; }
.chip input:focus-visible + span { outline: 2px solid var(--green); outline-offset: 2px; }
.field textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  background: var(--cream);
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  resize: vertical;
}
.field textarea:focus { outline: none; background: var(--paper); border-color: var(--green); box-shadow: 0 0 0 4px rgb(23 134 74 / 0.14); }

/* Admin: storage requests */
.badge-ask { margin-left: 6px; padding: 2px 8px; background: var(--gold-l); color: #6b5513; font-size: 11px; }
.list-requests {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: -8px 0 24px;
  padding: 12px 16px;
  border: 1px solid #ecd58c;
  border-radius: 14px;
  background: #fbf3d9;
  color: #6b5513;
  font-size: 13.5px;
}
.list-requests svg { flex: none; width: 20px; height: 20px; }
.list-requests strong { font-weight: 500; color: #4d3d0c; }
.org-requests {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin: -6px 0 22px;
  padding: 16px 18px;
  border: 1px solid #ecd58c;
  border-radius: 16px;
  background: #fbf3d9;
  color: #6b5513;
  font-size: 13.5px;
}
.req-icon { flex: none; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: rgb(255 255 255 / 0.7); }
.req-icon svg { width: 20px; height: 20px; }
.req-main { flex: 1; min-width: 0; }
.req-main strong { display: block; margin-bottom: 4px; font-weight: 500; color: #4d3d0c; }
.req-main ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.req-main li span { color: #4d3d0c; }
.req-main b { font-weight: 500; color: #4d3d0c; }
.req-main q { display: block; margin-top: 2px; font-style: italic; color: #7d6206; }
.req-actions { display: flex; flex-wrap: wrap; gap: 8px; flex: none; align-self: center; }

@media (max-width: 640px) {
  .storage-alert { flex-wrap: wrap; }
  .sa-actions { width: 100%; padding-left: 32px; }
  .org-requests { flex-wrap: wrap; }
  .req-actions { width: 100%; }
  .seg span { padding: 0 10px; }
}

/* ---------- Two-step verification ---------- */

.otp-boxes { display: flex; gap: 8px; }
.otp-boxes input {
  width: 100%;
  min-width: 0;
  height: 56px;
  padding: 0;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: #fff;
  font: 500 24px/1 var(--font);
  text-align: center;
  color: var(--ink);
  caret-color: var(--green);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.otp-boxes input:nth-child(3) { margin-right: 10px; }
.otp-boxes input:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 4px rgb(23 134 74 / 0.14); }
.otp-boxes.is-error input { border-color: var(--danger); animation: shake 0.32s; }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }

/* Sign-in code step */
.totp-form { display: grid; gap: 18px; }
.totp-head { text-align: center; }
.totp-icon {
  display: inline-grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin-bottom: 14px;
  border-radius: 16px;
  background: var(--green-l);
  color: var(--green-d);
}
.totp-icon svg { width: 26px; height: 26px; }
.totp-head h2 { font-size: clamp(24px, 2.2vw, 30px); font-weight: 500; letter-spacing: -0.015em; }
.totp-head p { margin-top: 8px; color: var(--ink-2); font-size: 15px; line-height: 1.45; }
.totp-head b { font-weight: 500; color: var(--ink); }
.totp-form .field { margin: 0; }
.totp-form .form-error { margin: 0; }
.totp-form .btn-block { margin-top: 0 !important; }
.totp-links { display: flex; justify-content: space-between; gap: 12px; font-size: 13.5px; }

/* Settings card */
.acc-tfa .acc-head { align-items: center; }
.acc-head .tfa-state { margin-left: auto; }
.acc-icon.is-off { background: rgb(16 41 29 / 0.06); color: var(--ink-3); }
.tfa-state { flex: none; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.tfa-state.is-on { background: var(--green-l); color: var(--green-d); }
.tfa-state.is-off { background: rgb(16 41 29 / 0.07); color: var(--ink-3); }
.tfa-points { list-style: none; display: grid; gap: 8px; margin: 0 0 20px; padding: 0; font-size: 13.5px; color: var(--ink-2); }
.tfa-points li { position: relative; padding-left: 22px; }
.tfa-points li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--green) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 6.2 5.1 8.2 9 4' fill='none' stroke='white' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 10px no-repeat;
}
.tfa-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 20px; margin: 0 0 18px; padding: 14px 16px; border-radius: 12px; background: var(--cream); }
.tfa-facts dt { font-size: 12px; color: var(--ink-3); }
.tfa-facts dd { margin: 2px 0 0; font-size: 14px; font-weight: 500; }
.tfa-facts dd.is-low { color: #9a4a0e; }
.tfa-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.acc-main { display: grid; gap: 20px; }
.acc-main .panel + .panel { margin-top: 0; }
#acc-2fa.is-on { color: var(--green-d); }
#acc-2fa.is-off { color: #9a4a0e; }

/* Setup dialog */
.modal-tfa { position: relative; max-width: 600px; max-height: calc(100vh - 40px); overflow: auto; }
.modal-tfa .modal-x { position: absolute; top: 14px; right: 14px; }
.tfa-steps { list-style: none; display: flex; gap: 6px; margin: 0 40px 18px 0; padding: 0; counter-reset: s; }
.tfa-steps li {
  flex: 1;
  padding-top: 8px;
  border-top: 3px solid rgb(16 41 29 / 0.1);
  font-size: 11.5px;
  color: var(--ink-3);
  counter-increment: s;
}
.tfa-steps li::before { content: counter(s) ". "; }
.tfa-steps li.is-on { border-color: var(--green); color: var(--green-d); font-weight: 500; }
.tfa-step h2 { margin-bottom: 8px; padding-right: 30px; }
.tfa-step .modal-sub { margin: 0 0 18px; }
.tfa-scan { display: grid; grid-template-columns: 196px minmax(0, 1fr); gap: 24px; align-items: start; margin: 14px 0 6px; }
.tfa-qr { padding: 10px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.tfa-qr svg { display: block; width: 100%; height: auto; }
.tfa-howto { list-style: none; display: grid; gap: 14px; margin: 0; padding: 0; counter-reset: h; }
.tfa-howto li { position: relative; padding-left: 34px; counter-increment: h; font-size: 13.5px; }
.tfa-howto li::before {
  content: counter(h);
  position: absolute;
  left: 0;
  top: 0;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--green-l);
  color: var(--green-d);
  font-size: 12px;
  font-weight: 600;
}
.tfa-howto strong { display: block; font-weight: 500; }
.tfa-howto span { display: block; color: var(--ink-2); }
.tfa-howto .otp-boxes { margin-top: 10px; }
.tfa-howto .otp-boxes input { height: 48px; font-size: 20px; }
.tfa-key { display: flex !important; align-items: center; gap: 6px; margin-top: 6px; }
.tfa-key code {
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--cream);
  border: 1px solid var(--line);
  font: 500 13px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.04em;
  color: var(--ink);
  word-break: break-all;
}
.recovery-grid {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 14px;
  padding: 16px;
  border: 1px dashed var(--line-2);
  border-radius: 14px;
  background: var(--cream);
}
.recovery-grid code { font: 500 15px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: 0.06em; color: var(--ink); }
.tfa-code-actions { display: flex; gap: 8px; margin-bottom: 16px; }
.check-row { display: flex; align-items: center; gap: 10px; font-size: 14px; cursor: pointer; }
#tfa-confirm-form .otp-boxes { margin-bottom: 12px; }
#tfa-confirm-form .link-btn { font-size: 13px; }

/* Admin */
.badge-2fa-on { background: var(--green-l); color: var(--green-d); }
.badge-2fa-off { background: rgb(16 41 29 / 0.06); color: var(--ink-3); }
.data-table td.actions .btn + .btn { margin-left: 6px; }
.tfa-nudge {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
  padding: 14px 16px;
  border-radius: 16px;
  background: var(--ink);
  color: rgb(251 246 239 / 0.75);
  font-size: 13.5px;
}
.tfa-nudge strong { display: block; margin-bottom: 2px; font-weight: 500; color: #fff; }
.tfa-nudge-icon { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: rgb(255 255 255 / 0.1); color: #f0cd62; }
.tfa-nudge-icon svg { width: 22px; height: 22px; }
.tfa-nudge > div:nth-child(2) { flex: 1; min-width: 0; }
.tfa-nudge-actions { display: flex; gap: 6px; flex: none; }
.tfa-nudge .btn-ghost { color: rgb(251 246 239 / 0.75); }
.tfa-nudge .btn-ghost:hover { background: rgb(255 255 255 / 0.1); color: #fff; }
#tfa-settings .modal { position: relative; }
#tfa-settings .modal-x { position: absolute; top: 14px; right: 14px; }
#tfa-settings .acc-head { padding-right: 36px; }

@media (max-width: 640px) {
  .tfa-scan { grid-template-columns: 1fr; }
  .tfa-qr { width: 200px; margin: 0 auto; }
  .otp-boxes { gap: 6px; }
  .otp-boxes input { height: 50px; font-size: 20px; }
  .otp-boxes input:nth-child(3) { margin-right: 6px; }
  .tfa-nudge { flex-wrap: wrap; }
  .tfa-nudge-actions { width: 100%; padding-left: 54px; }
  .tfa-facts { grid-template-columns: 1fr; }
}

/* ---------- Roles, access & activity (admin) ---------- */

.view-only-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px;
  border-radius: 10px;
  background: rgb(16 41 29 / 0.06);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-2);
}
.view-only-pill svg { width: 15px; height: 15px; }

.cap-chips, .access-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.cap-chips { margin-top: 12px; }
.access-chips { margin-top: 12px; }
.access-chips > span:first-child { margin-right: 4px; font-size: 12px; color: var(--ink-2); }
.cap-chip {
  padding: 2px 8px;
  border-radius: 20px;
  background: rgb(255 253 249 / 0.75);
  border: 1px solid rgb(16 41 29 / 0.1);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--green-d);
}
.cap-chip.is-none { color: var(--ink-3); }

.alloc-note {
  margin: -8px 0 24px;
  padding: 12px 16px;
  border: 1px solid #f2c39c;
  border-radius: 14px;
  background: #fcebdc;
  color: #7a3a0b;
  font-size: 13.5px;
}
.alloc-note strong { display: block; font-weight: 500; color: #9a4a0e; }
.alloc-note a { color: #9a4a0e; font-weight: 500; }

.page-head-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head .eyebrow { margin-bottom: 8px; }

/* Activity timeline */
.act-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.act-filters select {
  height: 34px;
  padding: 0 28px 0 10px;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: var(--paper) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236d776f' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") right 8px center / 13px no-repeat;
  appearance: none;
  -webkit-appearance: none;
  font-size: 13px;
  color: var(--ink);
}
.act-search { flex: 1 1 240px; width: auto; }
.act-alerts { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); cursor: pointer; }
.act-export { margin-left: auto; }
.act-count { margin-bottom: 4px; font-size: 12.5px; color: var(--ink-3); }
.act-day {
  position: sticky;
  top: 0;
  z-index: 1;
  margin: 14px 0 4px;
  padding: 6px 0;
  background: var(--paper);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.act-rows { list-style: none; margin: 0; padding: 0; }
.act-row { border-radius: 12px; }
.act-row + .act-row { border-top: 1px solid var(--line); }
.act-main {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto 56px;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 8px;
  border: 0;
  border-radius: 12px;
  background: none;
  font-size: 13.5px;
  color: var(--ink-2);
  text-align: left;
}
.act-main:hover { background: rgb(16 41 29 / 0.035); }
.act-row.is-open .act-main { background: var(--cream); }
.act-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--green-l); color: var(--green-d); }
.act-icon svg { width: 17px; height: 17px; }
.act-icon.cat-auth { background: rgb(16 41 29 / 0.07); color: var(--ink); }
.act-icon.cat-folder { background: #fbf3d9; color: #7d6206; }
.act-icon.cat-organization, .act-icon.cat-storage { background: #fcebdc; color: #9a4a0e; }
.act-icon.cat-account, .act-icon.cat-portal { background: #eef0e1; color: #3f6b17; }
.act-icon.cat-access, .act-icon.cat-security { background: #fbf3d9; color: #6b5513; }
.act-row.is-alert .act-icon { background: var(--danger-l); color: var(--danger); }
.act-text { min-width: 0; line-height: 1.45; overflow-wrap: anywhere; }
.act-text b { font-weight: 500; color: var(--ink); }
.act-role {
  margin: 0 6px 0 6px;
  padding: 1px 6px;
  border-radius: 6px;
  background: rgb(16 41 29 / 0.06);
  font-size: 11px;
  color: var(--ink-3);
  vertical-align: 1px;
}
.act-org { max-width: 180px; padding: 2px 8px; border-radius: 20px; background: rgb(16 41 29 / 0.05); font-size: 12px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.act-main time { font-size: 12px; color: var(--ink-3); text-align: right; font-variant-numeric: tabular-nums; }
.act-details { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 20px; margin: 0; padding: 4px 16px 16px 54px; font-size: 13px; }
.act-details dt { font-size: 11.5px; color: var(--ink-3); }
.act-details dd { margin: 2px 0 0; overflow-wrap: anywhere; }
.act-details .wide { grid-column: 1 / -1; }
.act-details pre { margin: 4px 0 0; padding: 10px 12px; border-radius: 10px; background: var(--cream); font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; }
.act-details code { font: 12px ui-monospace, SFMono-Regular, Menlo, monospace; }
.act-more { display: flex; justify-content: center; margin-top: 14px; }

/* Team & access */
.badge-super { background: var(--ink); color: var(--cream); }
.badge-admin { background: var(--gold-l); color: #6b5513; }
.you-tag { margin-left: 4px; padding: 1px 6px; border-radius: 6px; background: var(--green-l); color: var(--green-d); font-size: 11px; font-weight: 500; }
.team-access { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 12.5px; color: var(--ink-2); }
.team-grant b { font-weight: 500; color: var(--ink); }
.team-table td.actions { white-space: normal; }
.team-table td.actions .btn { margin: 2px 0 2px 6px; }

.role-pick { display: grid; gap: 8px; }
.role-opt { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--line-2); border-radius: 12px; cursor: pointer; }
.role-opt:has(input:checked) { border-color: var(--green); background: var(--green-l); }
.role-opt input { margin-top: 3px; accent-color: var(--green); }
.role-opt strong { display: block; font-size: 14px; font-weight: 500; }
.role-opt small { display: block; font-size: 12.5px; color: var(--ink-2); }

.modal-access { position: relative; max-width: 900px; max-height: calc(100vh - 40px); display: flex; flex-direction: column; }
.modal-access .modal-x { position: absolute; top: 14px; right: 14px; }
.modal-access h2 { padding-right: 36px; }
.modal-access .modal-sub { margin-top: -10px; }
.access-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.access-search { flex: 1 1 220px; width: auto; }
.access-tools select { height: 32px; padding: 0 8px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--paper); font-size: 13px; }
.access-grid-wrap { min-height: 0; overflow: auto; border: 1px solid var(--line); border-radius: 14px; }
.access-grid { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.access-grid th, .access-grid td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: center; }
.access-grid thead th { position: sticky; top: 0; z-index: 1; background: var(--cream); font-size: 12px; font-weight: 500; color: var(--ink-2); }
.access-grid tbody th { display: flex; align-items: center; gap: 10px; min-width: 200px; text-align: left; font-weight: 500; }
.access-grid thead th:first-child { text-align: left; }
.access-grid .org-chip { width: 28px; height: 28px; border-radius: 8px; font-size: 11px; }
.access-grid select { height: 30px; padding: 0 6px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--paper); font-size: 12.5px; }
.access-grid tr.is-none th, .access-grid tr.is-none select { color: var(--ink-3); }
.access-grid tbody tr:last-child > * { border-bottom: 0; }
.access-legend { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px 16px; margin: 14px 0 0; font-size: 12px; }
.access-legend dt { font-weight: 600; color: var(--ink); }
.access-legend dd { margin: 0; color: var(--ink-3); }
.access-summary { margin-right: auto; font-size: 13px; color: var(--ink-3); }

/* Input with a side button/select (temporary password dialog) */
.unit-input { display: flex; gap: 8px; }
.unit-input input { flex: 1; }
.unit-input select { width: 90px; height: 48px; padding: 0 10px; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--cream); font-size: 15px; }

@media (max-width: 900px) {
  .access-legend { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .act-main { grid-template-columns: 30px minmax(0, 1fr); }
  .act-org, .act-main time { grid-column: 2; justify-self: start; }
  .act-details { grid-template-columns: 1fr; padding-left: 12px; }
  .act-export { margin-left: 0; }
  .access-legend { grid-template-columns: 1fr; }
}
.team-table th, .team-table .badge, .team-table td[data-label="Two-step"], .team-table td[data-label="Last sign-in"] { white-space: nowrap; }
.team-table .name { overflow-wrap: anywhere; }

/* First sign-in password change */
.badge-pending { margin-top: 4px; background: #fbf3d9; color: #6b5513; font-size: 11px; }
.pwc-form .pw-rules { grid-template-columns: 1fr 1fr; }

/* Row actions: main button + ⋯ menu */
.row-actions { display: inline-flex; align-items: center; justify-content: flex-end; gap: 6px; }
.row-more-wrap { position: relative; }
.row-more { width: 34px; height: 34px; border: 1px solid var(--line); background: var(--paper); color: var(--ink-2); }
.row-more:hover, .row-more[aria-expanded="true"] { border-color: var(--line-2); background: var(--cream); color: var(--ink); }
.row-more svg { width: 18px; height: 18px; }
.row-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 30;
  min-width: 230px;
  padding: 6px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 24px 60px -20px rgb(16 41 29 / 0.45), 0 2px 6px rgb(16 41 29 / 0.06);
  text-align: left;
  animation: pop 0.12s ease-out;
}
.row-menu .um-item { height: 36px; font-size: 13.5px; white-space: nowrap; }
.team-table td.actions, .data-table td.actions { width: 1%; white-space: nowrap; }
.team-table td.actions .btn { margin: 0; }
.team-table .name { white-space: nowrap; }

/* Portal storage panel (admin Organizations page) */
.portal-panel { margin: -6px 0 24px; padding: 18px 20px; }
.pp-head { display: flex; align-items: center; gap: 14px; }
.pp-title { flex: 1; min-width: 0; }
.pp-title strong { display: block; font-size: 16px; font-weight: 500; }
.pp-title span { font-size: 13px; color: var(--ink-2); }
.pp-pct { font-size: 24px; font-weight: 500; letter-spacing: -0.02em; color: var(--green-d); font-variant-numeric: tabular-nums; }
.pp-pct.is-high { color: #9a4a0e; }
.pp-pct.is-full { color: var(--danger); }
.pp-bar { position: relative; height: 10px; margin: 14px 0 12px; border-radius: 6px; background: rgb(16 41 29 / 0.08); overflow: hidden; }
.pp-bar span { position: absolute; inset: 0 auto 0 0; border-radius: 6px; }
.pp-alloc { background: rgb(23 134 74 / 0.22); }
.pp-used { background: var(--green); }
.pp-used.is-high { background: var(--orange); }
.pp-used.is-full { background: var(--danger); }
.pp-facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px 18px; margin: 0; }
.pp-facts dt { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-3); }
.pp-facts dd { margin: 2px 0 0; font-size: 15px; font-weight: 500; font-variant-numeric: tabular-nums; }
.pp-facts .sw { width: 10px; height: 10px; border-radius: 3px; }
.sw-used { background: var(--green); }
.sw-alloc { background: rgb(23 134 74 / 0.22); }
.pp-warn { margin-top: 12px; padding: 10px 12px; border-radius: 10px; background: #fcebdc; color: #7a3a0b; font-size: 13px; }
.pp-note { margin-top: 12px; font-size: 12.5px; color: var(--ink-3); }
@media (max-width: 640px) {
  .pp-facts { grid-template-columns: 1fr 1fr; }
}

/* ----- Names ----- */
.acc-rename { display: inline-grid; place-items: center; width: 28px; height: 28px; margin-left: 4px; vertical-align: middle; border: 0; border-radius: 8px; background: transparent; color: var(--ink-3); cursor: pointer; }
.acc-rename:hover, .acc-rename:focus-visible { background: rgba(127,127,127,.14); color: var(--ink); }
.acc-rename svg { width: 16px; height: 16px; }
.acc-id .acc-email { display: block; margin: 2px 0 0; color: var(--ink-3); font-size: 14px; overflow-wrap: anywhere; }
.person { display: flex; flex-direction: column; min-width: 0; }
.person .person-email { font-size: 12px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person .no-name { color: var(--ink-3); font-style: italic; font-weight: 400; }
.modal-sub { margin: -4px 0 14px; color: var(--ink-3); font-size: 14px; }

/* Portal storage: quiet line normally, a warning from 80% used */
.portal-panel.is-warning { border-color: #f0c9a4; }
.pp-alert { margin: 16px 0 4px; padding: 10px 12px; border-radius: 10px; font-size: 13.5px; font-weight: 500; background: #fcebdc; color: #7a3a0b; }
.pp-alert.is-full { background: #fbe3e1; color: var(--danger); }

/* Backup reminder at the end of every page: quiet, not a highlight */
.backup-note { margin: 40px 0 8px; font-size: 12.5px; line-height: 1.5; color: var(--ink-3); text-align: center; }
.backup-note a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.backup-note a:hover { color: var(--ink-2); }
.backup-note.is-login { flex: none; margin: 8px 0 0; font-size: 12px; }
.login-side { overflow-y: auto; }

/* Blocked accounts */
.badge-blocked { margin-top: 4px; background: var(--danger-l); color: var(--danger); font-size: 11px; }
.list-blocked { margin: -8px 0 24px; padding: 14px 16px; border: 1px solid #efc2b4; border-radius: 14px; background: #fbeae4; color: #7a2d1b; font-size: 13.5px; }
.list-blocked .lb-head { display: flex; align-items: center; gap: 12px; }
.list-blocked svg { flex: none; width: 20px; height: 20px; }
.list-blocked strong { font-weight: 500; color: #5e2112; }
.list-blocked .lb-list { list-style: none; margin: 10px 0 0; padding: 0 0 0 32px; }
.list-blocked .lb-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid rgb(122 45 27 / 0.14); }
.list-blocked .lb-who { min-width: 0; overflow-wrap: anywhere; }
.list-blocked .lb-who b { font-weight: 500; color: #5e2112; }
.list-blocked .muted { color: #8a5446; }
@media (max-width: 600px) { .list-blocked .lb-list { padding-left: 0; } .list-blocked .lb-list li { flex-wrap: wrap; } }

/* Delete organization */
.org-delete-link { margin-right: auto; }
.del-choice { margin: 0 0 16px; padding: 0; border: 0; }
.del-choice legend { margin-bottom: 8px; }
.del-target { margin: 0 0 4px 34px; }
.del-target[hidden] { display: none; }
.role-opt.is-danger:has(input:checked) { border-color: var(--danger); background: var(--danger-l); }
.role-opt.is-danger input { accent-color: var(--danger); }
.role-opt:has(input:disabled) { opacity: 0.55; cursor: not-allowed; }
@media (max-width: 600px) { .del-target { margin-left: 0; } }
