:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-serif: "Songti SC", "Noto Serif SC", "Source Han Serif SC", "STSong", "SimSun", serif;
  --font-kai: "Kaiti SC", "STKaiti", "KaiTi", "KaiTi_GB2312", "FangSong", serif;
  --font-rounded: "Yuanti SC", "YouYuan", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font: var(--font-sans);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --ink: #18201e;
  --ink-soft: #3e4a47;
  --muted: #73807c;
  --muted-2: #9aa5a1;
  --line: #e4e9e7;
  --line-strong: #d3dbd8;
  --canvas: #f3f5f4;
  --surface: #ffffff;
  --surface-soft: #f8faf9;
  --surface-tint: #eef4f2;
  --accent: #1e6f5c;
  --accent-rgb: 30, 111, 92;
  --accent-strong: #155646;
  --accent-soft: #e6f2ee;
  --accent-line: #c8e2d9;
  --danger: #b23b3b;
  --danger-strong: #962f2f;
  --danger-soft: #fcefee;
  --warning: #96651e;
  --warning-soft: #fbf4e5;
  --dark: #10241f;
  --dark-hover: #071a15;
  --warm-sand: #f3e2c8;
  --warm-sand-strong: #e8cfa9;
  --warm-red: #a8432d;
  --warm-red-strong: #8f3522;
  --warm-line: #ddc29c;
  --sidebar-bg: var(--surface);
  --sidebar-ink: var(--ink);
  --sidebar-item: var(--ink-soft);
  --sidebar-muted: var(--muted);
  --sidebar-line: var(--line);
  --sidebar-hover: var(--surface-soft);
  --sidebar-active-bg: var(--surface-tint);
  --sidebar-active-ink: var(--accent-strong);
  --sidebar-scrim: rgba(255, 255, 255, 0.78);
  --sidebar-badge-bg: rgba(var(--accent-rgb), 0.08);
  --sidebar-badge-ink: var(--accent);
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --shadow-sm: 0 1px 2px rgba(15, 24, 21, 0.04);
  --shadow-md: 0 14px 38px rgba(15, 24, 21, 0.08);
  --shadow-lg: 0 24px 70px rgba(9, 16, 13, 0.18);
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

html[data-font="serif"] {
  --font: var(--font-serif);
}

html[data-font="kai"] {
  --font: var(--font-kai);
}

html[data-font="rounded"] {
  --font: var(--font-rounded);
}

html[data-text="charcoal"] {
  --ink: #262c2e;
  --ink-soft: #47514f;
  --muted: #667271;
  --muted-2: #8e9997;
}

html[data-text="sepia"] {
  --ink: #38281b;
  --ink-soft: #5b4636;
  --muted: #7c6857;
  --muted-2: #a6937f;
}

html[data-text="navy"] {
  --ink: #1b3352;
  --ink-soft: #3a5877;
  --muted: #5f7a94;
  --muted-2: #93a7ba;
}

html[data-text="forest"] {
  --ink: #173a2e;
  --ink-soft: #33594a;
  --muted: #5b7d6f;
  --muted-2: #8ba79a;
}

html[data-text="wine"] {
  --ink: #52202c;
  --ink-soft: #6f3c49;
  --muted: #8a5f6c;
  --muted-2: #b1939d;
}

html[data-sidebar="sand"] {
  --sidebar-bg: #f6ecdc;
  --sidebar-ink: #3d2f22;
  --sidebar-item: #5a4835;
  --sidebar-muted: #8b7661;
  --sidebar-line: rgba(94, 72, 45, 0.14);
  --sidebar-hover: rgba(255, 255, 255, 0.55);
  --sidebar-active-bg: rgba(255, 255, 255, 0.85);
  --sidebar-active-ink: #8a4a26;
  --sidebar-scrim: rgba(247, 239, 227, 0.72);
  --sidebar-badge-bg: rgba(255, 255, 255, 0.68);
  --sidebar-badge-ink: #8a4a26;
}

html[data-sidebar="sage"] {
  --sidebar-bg: #e9f0ea;
  --sidebar-ink: #24362e;
  --sidebar-item: #40574b;
  --sidebar-muted: #6f8478;
  --sidebar-line: rgba(36, 54, 46, 0.13);
  --sidebar-hover: rgba(255, 255, 255, 0.55);
  --sidebar-active-bg: rgba(255, 255, 255, 0.85);
  --sidebar-active-ink: #25604e;
  --sidebar-scrim: rgba(233, 240, 234, 0.72);
  --sidebar-badge-bg: rgba(255, 255, 255, 0.68);
  --sidebar-badge-ink: #25604e;
}

html[data-sidebar="sky"] {
  --sidebar-bg: #e9f1f8;
  --sidebar-ink: #1f3347;
  --sidebar-item: #3b536a;
  --sidebar-muted: #6d8298;
  --sidebar-line: rgba(31, 51, 71, 0.12);
  --sidebar-hover: rgba(255, 255, 255, 0.55);
  --sidebar-active-bg: rgba(255, 255, 255, 0.85);
  --sidebar-active-ink: #1d5584;
  --sidebar-scrim: rgba(233, 241, 248, 0.72);
  --sidebar-badge-bg: rgba(255, 255, 255, 0.68);
  --sidebar-badge-ink: #1d5584;
}

html[data-sidebar="blush"] {
  --sidebar-bg: #f8e9e6;
  --sidebar-ink: #432b2b;
  --sidebar-item: #614444;
  --sidebar-muted: #937a7a;
  --sidebar-line: rgba(67, 43, 43, 0.12);
  --sidebar-hover: rgba(255, 255, 255, 0.55);
  --sidebar-active-bg: rgba(255, 255, 255, 0.85);
  --sidebar-active-ink: #a24a3e;
  --sidebar-scrim: rgba(248, 233, 230, 0.72);
  --sidebar-badge-bg: rgba(255, 255, 255, 0.68);
  --sidebar-badge-ink: #a24a3e;
}

html[data-sidebar="night"] {
  --sidebar-bg: #1b2724;
  --sidebar-ink: #eef2ef;
  --sidebar-item: rgba(238, 242, 239, 0.8);
  --sidebar-muted: rgba(238, 242, 239, 0.55);
  --sidebar-line: rgba(255, 255, 255, 0.1);
  --sidebar-hover: rgba(255, 255, 255, 0.07);
  --sidebar-active-bg: rgba(255, 255, 255, 0.13);
  --sidebar-active-ink: #f3dcb8;
  --sidebar-scrim: rgba(15, 22, 20, 0.6);
  --sidebar-badge-bg: rgba(255, 255, 255, 0.14);
  --sidebar-badge-ink: #f3dcb8;
}

html[data-canvas="sand"] {
  --canvas: #f6f1e8;
  --surface-soft: #fbf8f2;
  --surface-tint: #f3ecdf;
  --accent: #9a6a1f;
  --accent-rgb: 154, 106, 31;
  --accent-strong: #7c5315;
  --accent-soft: #f5ecda;
  --accent-line: #e3d1ae;
  --dark: #2a2117;
  --dark-hover: #1c150d;
}

html[data-canvas="sky"] {
  --canvas: #edf3f8;
  --surface-soft: #f6f9fc;
  --surface-tint: #e7f0f7;
  --accent: #2b6da3;
  --accent-rgb: 43, 109, 163;
  --accent-strong: #1d5584;
  --accent-soft: #e4eff8;
  --accent-line: #c6ddec;
  --dark: #142536;
  --dark-hover: #0b1826;
}

html[data-canvas="lilac"] {
  --canvas: #f2eff7;
  --surface-soft: #f9f7fc;
  --surface-tint: #efe9f7;
  --accent: #6b4f9e;
  --accent-rgb: 107, 79, 158;
  --accent-strong: #553b82;
  --accent-soft: #ece6f6;
  --accent-line: #d8cce9;
  --dark: #211a2e;
  --dark-hover: #171020;
}

html[data-canvas="peach"] {
  --canvas: #f9f1ed;
  --surface-soft: #fdf8f6;
  --surface-tint: #f8eae3;
  --accent: #aa5136;
  --accent-rgb: 170, 81, 54;
  --accent-strong: #8a3f28;
  --accent-soft: #fae9e2;
  --accent-line: #efd0c3;
  --dark: #2c1b16;
  --dark-hover: #200f0b;
}

html[data-canvas="cloud"] {
  --canvas: #f0f2f4;
  --surface-soft: #f8f9fa;
  --surface-tint: #e9edf0;
  --accent: #506a7a;
  --accent-rgb: 80, 106, 122;
  --accent-strong: #3c5260;
  --accent-soft: #e8eef1;
  --accent-line: #cbd7de;
  --dark: #1b2329;
  --dark-hover: #11181c;
}

html[data-canvas="berry"] {
  --canvas: #f8eff2;
  --surface-soft: #fcf7f9;
  --surface-tint: #f7e8ed;
  --accent: #a23d5f;
  --accent-rgb: 162, 61, 95;
  --accent-strong: #83304c;
  --accent-soft: #f8e6ec;
  --accent-line: #eccbd7;
  --dark: #2a141c;
  --dark-hover: #1d0c12;
}

html[data-canvas="indigo"] {
  --canvas: #eef0f7;
  --surface-soft: #f7f8fc;
  --surface-tint: #e8ebf5;
  --accent: #47548f;
  --accent-rgb: 71, 84, 143;
  --accent-strong: #364172;
  --accent-soft: #e8eaf5;
  --accent-line: #cbcfeb;
  --dark: #171c30;
  --dark-hover: #0e1222;
}

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

html {
  -webkit-text-size-adjust: 100%;
  font-size: 18px;
}

html[data-font-scale="sm"] {
  font-size: 16px;
}

html[data-font-scale="md"] {
  font-size: 18px;
}

html[data-font-scale="lg"] {
  font-size: 19px;
}

html[data-font-scale="xl"] {
  font-size: 20px;
}

body {
  margin: 0;
  min-width: 320px;
  background-color: var(--canvas);
  color: var(--ink);
  font-family: var(--font);
  font-size: 0.9375rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

html[data-canvas-bg="image"] body {
  background-image:
    linear-gradient(rgba(250, 251, 250, 0.72), rgba(250, 251, 250, 0.82)),
    var(--canvas-image);
  background-attachment: fixed;
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
}

html[data-canvas-bg="image"] .shell {
  background: transparent;
}

html[data-canvas-bg="image"] .boot-screen {
  background:
    linear-gradient(rgba(250, 251, 250, 0.8), rgba(250, 251, 250, 0.88)),
    var(--canvas-image) center / cover no-repeat;
}

body.is-locked {
  overflow: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
}

h1,
h2,
h3,
p {
  overflow-wrap: break-word;
}

::selection {
  background: rgba(var(--accent-rgb), 0.16);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.icon {
  display: inline-flex;
  width: 18px;
  height: 18px;
  flex: none;
  align-items: center;
  justify-content: center;
}

.icon svg {
  display: block;
  width: 100%;
  height: 100%;
}

.muted {
  color: var(--muted);
}

.mono {
  font-family: var(--mono);
  font-size: 0.71875rem;
  letter-spacing: -0.02em;
}

.grow {
  flex: 1;
  min-width: 0;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(24, 32, 30, 0.16);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.boot-screen {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background:
    radial-gradient(circle at 50% 34%, rgba(var(--accent-rgb), 0.07), transparent 36%),
    var(--canvas);
  color: var(--muted);
}

.boot-copy {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.boot-copy strong {
  color: var(--ink);
  font-size: 1rem;
  font-weight: 650;
  letter-spacing: 0.02em;
}

.boot-copy span {
  font-size: 0.78125rem;
  color: var(--muted);
}

.boot-screen .spinner {
  margin-top: 2px;
}

.brand-mark {
  display: grid;
  width: 36px;
  height: 36px;
  flex: none;
  place-items: center;
  border: 1px solid var(--warm-line);
  border-radius: 10px;
  background: var(--warm-sand);
  color: var(--warm-red);
  font-size: 1.0625rem;
  font-weight: 650;
  line-height: 1;
}

.brand-mark--lg {
  width: 52px;
  height: 52px;
  border-radius: 15px;
  font-size: 1.4375rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  height: 38px;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 0.84375rem;
  font-weight: 600;
  letter-spacing: 0.005em;
  line-height: 1;
  white-space: nowrap;
  transition:
    background 0.18s ease,
    border-color 0.18s ease,
    color 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.18s var(--ease);
}

.btn .icon {
  width: 16px;
  height: 16px;
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.btn--primary {
  border-color: var(--warm-line);
  background: var(--warm-sand);
  color: var(--warm-red);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    0 1px 2px rgba(90, 50, 20, 0.12);
}

.btn--primary:hover:not(:disabled) {
  background: var(--warm-sand-strong);
  color: var(--warm-red-strong);
}

.btn--secondary {
  border-color: var(--line-strong);
  background: var(--surface);
  color: var(--ink-soft);
  box-shadow: var(--shadow-sm);
}

.btn--secondary:hover:not(:disabled) {
  border-color: #bec9c5;
  background: var(--surface-soft);
}

.btn--ghost {
  color: var(--ink-soft);
}

.btn--ghost:hover:not(:disabled) {
  background: var(--surface-tint);
  color: var(--ink);
}

.btn--danger {
  background: var(--danger);
  color: #fff;
}

.btn--danger:hover:not(:disabled) {
  background: var(--danger-strong);
}

.btn--danger-ghost {
  color: var(--danger);
}

.btn--danger-ghost:hover:not(:disabled) {
  background: var(--danger-soft);
}

.btn--sm {
  height: 32px;
  min-height: 32px;
  padding: 0 10px;
  border-radius: 8px;
  font-size: 0.78125rem;
}

.btn--icon {
  width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  border-radius: 8px;
}

.btn--icon.btn--sm {
  width: 30px;
  height: 30px;
  min-height: 30px;
}

.btn.is-loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}

.btn.is-loading > * {
  visibility: hidden;
}

.btn.is-loading::after {
  content: "";
  position: absolute;
  width: 15px;
  height: 15px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.btn--secondary.is-loading::after,
.btn--ghost.is-loading::after {
  border-color: rgba(24, 32, 30, 0.16);
  border-top-color: var(--accent);
}

.icon-btn {
  display: inline-grid;
  width: 32px;
  height: 32px;
  flex: none;
  place-items: center;
  border-radius: 8px;
  color: var(--muted);
  transition:
    background 0.16s ease,
    color 0.16s ease;
}

.icon-btn:hover {
  background: var(--surface-tint);
  color: var(--ink);
}

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

/* Forms */
.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.field > label {
  color: var(--ink-soft);
  font-size: 0.8125rem;
  font-weight: 600;
}

.input,
.select,
.textarea {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  outline: none;
  background: #fbfcfb;
  color: var(--ink);
  font-size: 0.90625rem;
  line-height: 1.4;
  transition:
    border-color 0.16s ease,
    box-shadow 0.16s ease,
    background 0.16s ease;
}

.input::placeholder,
.textarea::placeholder {
  color: #abb4b1;
}

.input:hover,
.select:hover,
.textarea:hover {
  border-color: #c4cecb;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.11);
}

.input:disabled,
.select:disabled,
.textarea:disabled {
  cursor: not-allowed;
  background: #f2f4f3;
  color: var(--muted);
}

.textarea {
  min-height: 82px;
  resize: vertical;
}

.select-wrap {
  position: relative;
}

.select-wrap::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 14px;
  width: 6px;
  height: 6px;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: translateY(-68%) rotate(45deg);
  pointer-events: none;
}

.select {
  appearance: none;
  padding-right: 34px;
  cursor: pointer;
}

.field-hint {
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.6;
}

.input-wrap {
  position: relative;
}

.input-wrap .input {
  padding-right: 44px;
}

.input-action {
  position: absolute;
  top: 50%;
  right: 5px;
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 7px;
  color: var(--muted);
  transform: translateY(-50%);
}

.input-action:hover {
  background: var(--surface-tint);
  color: var(--ink-soft);
}

.input-action .icon {
  width: 16px;
  height: 16px;
}

.form-grid {
  display: grid;
  gap: 16px;
}

.form-grid--2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 4px;
}

.form-actions--split {
  justify-content: space-between;
}

.form-error {
  display: none;
  padding: 9px 11px;
  border: 1px solid #f0d3d0;
  border-radius: 8px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 0.78125rem;
  line-height: 1.5;
}

.form-error.is-visible {
  display: flex;
  align-items: flex-start;
  gap: 7px;
}

.form-error .icon {
  width: 14px;
  height: 14px;
  flex: none;
  margin-top: 1px;
}

.form-note {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.6;
}

.form-note strong {
  color: var(--ink-soft);
  font-weight: 600;
}

.perm-grid {
  display: flex;
  max-height: 268px;
  flex-direction: column;
  gap: 6px;
  overflow: auto;
  padding: 2px;
}

.perm-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2px 1px;
  color: var(--muted-2);
  font-size: 0.6875rem;
  letter-spacing: 0.04em;
}

.perm-row {
  display: flex;
  min-height: 42px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  transition: border-color 0.16s ease, background 0.16s ease;
}

.perm-row:hover {
  border-color: var(--line-strong);
  background: var(--surface);
}

.perm-name {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 0.8125rem;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.perm-toggles {
  display: flex;
  flex: none;
  gap: 6px;
}

.perm-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.3;
  cursor: pointer;
  user-select: none;
  transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.perm-toggle:hover {
  border-color: var(--line-strong);
  color: var(--ink-soft);
}

.perm-toggle input {
  width: 13px;
  height: 13px;
  flex: none;
  margin: 0;
  accent-color: var(--accent);
}

.perm-toggle:has(input:checked) {
  border-color: var(--accent-line);
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 600;
}

.perm-toggle.is-disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.field-section {
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding-top: 4px;
}

.field-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.field-section-head h3 {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.8125rem;
  font-weight: 600;
}

.field-section-head p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.71875rem;
  line-height: 1.5;
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  user-select: none;
}

.switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.switch-track {
  position: relative;
  width: 36px;
  height: 21px;
  flex: none;
  border-radius: 99px;
  background: #cbd4d1;
  transition: background 0.18s ease;
}

.switch-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 24, 21, 0.15);
  transition: transform 0.18s var(--ease);
}

.switch input:checked + .switch-track {
  background: var(--accent);
}

.switch input:checked + .switch-track::after {
  transform: translateX(15px);
}

.switch input:disabled + .switch-track {
  opacity: 0.45;
}

.switch-label {
  color: var(--ink-soft);
  font-size: 0.8125rem;
  font-weight: 500;
}

.badge {
  display: inline-flex;
  height: 21px;
  align-items: center;
  gap: 4px;
  padding: 0 8px;
  border-radius: 99px;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.badge--admin {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.badge--user {
  background: #f0f3f2;
  color: #5d6965;
}

.badge--muted {
  background: var(--danger-soft);
  color: var(--danger);
}

.badge--warning {
  background: var(--warning-soft);
  color: var(--warning);
}

.avatar {
  display: grid;
  width: 34px;
  height: 34px;
  flex: none;
  place-items: center;
  border: 1px solid var(--accent-line);
  border-radius: 50%;
  background: var(--surface-tint);
  color: var(--accent-strong);
  font-size: 0.84375rem;
  font-weight: 650;
  line-height: 1;
  text-transform: uppercase;
}

.avatar--lg {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  font-size: 1.4375rem;
}

.avatar--sm {
  width: 28px;
  height: 28px;
  font-size: 0.71875rem;
}

.chip {
  display: inline-flex;
  height: 25px;
  align-items: center;
  gap: 5px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 0.71875rem;
  white-space: nowrap;
}

.chip .icon {
  width: 13px;
  height: 13px;
  color: var(--muted);
}

.chip--accent {
  border-color: var(--accent-line);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.chip--accent .icon {
  color: var(--accent);
}

.chip--warning {
  border-color: #edddba;
  background: var(--warning-soft);
  color: var(--warning);
}

.chip--warning .icon {
  color: var(--warning);
}

.inline-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.65;
}

.inline-note .icon {
  width: 14px;
  height: 14px;
  margin-top: 1px;
  color: var(--muted-2);
}

/* Authentication */
.auth {
  display: grid;
  min-height: 100vh;
  padding: clamp(28px, 7vw, 80px) 22px;
  background:
    radial-gradient(circle at 88% 6%, rgba(var(--accent-rgb), 0.05), transparent 30%),
    var(--surface);
  place-items: center;
}

.auth-panel {
  width: min(100%, 390px);
}

.auth-card {
  width: 100%;
}

.auth-head h2 {
  margin: 0 0 8px;
  font-size: 1.6875rem;
  font-weight: 650;
  letter-spacing: -0.03em;
  line-height: 1.25;
}

.auth-head p {
  margin: 0 0 28px;
  color: var(--muted);
  font-size: 0.84375rem;
  line-height: 1.75;
}

.auth-form {
  display: grid;
  gap: 15px;
}

.auth-form .field > label {
  font-size: 0.78125rem;
}

.auth-form .input {
  min-height: 43px;
  font-size: 0.90625rem;
}

.auth-submit {
  width: 100%;
  height: 44px;
  margin-top: 3px;
  border-color: var(--warm-sand-strong);
  background: var(--surface);
  color: var(--warm-red-strong);
  font-weight: 700;
  box-shadow: 0 2px 10px rgba(168, 67, 45, 0.1), 0 1px 2px rgba(90, 50, 20, 0.08);
}

.auth-submit:hover:not(:disabled) {
  border-color: var(--warm-sand-strong);
  background: var(--warm-sand);
  color: var(--warm-red-strong);
}

.auth-submit:active:not(:disabled) {
  background: var(--warm-sand-strong);
}

.auth-error {
  display: none;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid #f0d3d0;
  border-radius: 9px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 0.78125rem;
  line-height: 1.55;
}

.auth-error.is-visible {
  display: flex;
}

.auth-error .icon {
  width: 15px;
  height: 15px;
  margin-top: 1px;
}

/* Shell */
.shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: 264px minmax(0, 1fr);
  background: var(--canvas);
}

.sidebar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  overflow-y: auto;
  height: 100vh;
  flex-direction: column;
  padding: 22px 16px 18px;
  border-right: 1px solid var(--sidebar-line);
  background-color: var(--sidebar-bg);
}

html[data-sidebar-bg="image"] .sidebar {
  background-image:
    linear-gradient(var(--sidebar-scrim), var(--sidebar-scrim)),
    var(--sidebar-image);
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 2px 6px 0;
}

.brand-text {
  display: flex;
  min-width: 0;
  flex-direction: column;
  line-height: 1.2;
}

.brand-text strong {
  overflow: hidden;
  color: var(--sidebar-ink);
  font-size: 0.96875rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-text span {
  margin-top: 3px;
  color: var(--sidebar-muted);
  font-size: 0.59375rem;
  font-weight: 600;
  letter-spacing: 0.17em;
}

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 30px;
}

.nav-label {
  padding: 0 12px 8px;
  color: var(--sidebar-muted);
  font-size: 0.625rem;
  font-weight: 650;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.nav-item {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: 9px;
  color: var(--sidebar-item);
  font-size: 0.84375rem;
  font-weight: 550;
  text-align: left;
  transition:
    background 0.16s ease,
    color 0.16s ease;
}

.nav-item .icon {
  width: 17px;
  height: 17px;
  color: var(--sidebar-muted);
  transition: color 0.16s ease;
}

.nav-item:hover {
  background: var(--sidebar-hover);
  color: var(--sidebar-ink);
}

.nav-item.is-active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-ink);
  font-weight: 650;
}

.nav-item.is-active .icon {
  color: var(--sidebar-active-ink);
}

.nav-item.is-active:hover {
  color: var(--sidebar-active-ink);
}

.nav-badge {
  min-width: 19px;
  margin-left: auto;
  padding: 2px 6px;
  border-radius: 99px;
  background: var(--sidebar-badge-bg);
  color: var(--sidebar-badge-ink);
  font-size: 0.625rem;
  font-weight: 650;
  text-align: center;
}

.nav-badge--unread {
  background: var(--accent);
  color: #fff;
}

.sidebar-foot {
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid var(--sidebar-line);
}

.side-user {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px 4px 0;
}

.side-user-main {
  display: flex;
  min-width: 0;
  flex: 1;
  align-items: center;
  gap: 10px;
  padding: 5px;
  border-radius: 9px;
  text-align: left;
}

.side-user-main:hover {
  background: var(--sidebar-hover);
}

.side-user-meta {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 1px;
}

.side-user-name {
  overflow: hidden;
  color: var(--sidebar-ink);
  font-size: 0.8125rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.side-user-role {
  color: var(--sidebar-muted);
  font-size: 0.65625rem;
}

.sidebar .logout-btn {
  width: 29px;
  height: 29px;
  color: var(--sidebar-muted);
}

.sidebar .logout-btn:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

.sidebar-privacy {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 14px 8px 0;
  color: var(--sidebar-muted);
  font-size: 0.625rem;
  letter-spacing: 0.01em;
}

.sidebar-privacy .icon {
  width: 11px;
  height: 11px;
}

.mobile-topbar {
  display: none;
}

.main {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.content {
  width: 100%;
  max-width: 1240px;
  flex: 1;
  margin: 0 auto;
  padding: 40px clamp(24px, 4vw, 56px) 64px;
}

.nav-backdrop {
  display: none;
}

/* Page header */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 26px;
}

.page-head-main {
  min-width: 0;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 10px;
  color: var(--accent);
  font-size: 0.65625rem;
  font-weight: 650;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.eyebrow::before {
  content: "";
  width: 16px;
  height: 1px;
  background: var(--accent-line);
}

.page-head h1 {
  margin: 0;
  font-size: clamp(1.5625rem, 2.6vw, 2rem);
  font-weight: 650;
  letter-spacing: -0.03em;
  line-height: 1.18;
}

.page-head p {
  max-width: 660px;
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 0.8125rem;
  line-height: 1.7;
}

.page-actions {
  display: flex;
  flex: none;
  align-items: center;
  gap: 8px;
  padding-bottom: 2px;
}

.page-actions .btn {
  height: 36px;
  min-height: 36px;
}

/* Folders */
.folder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}

.folder-card {
  position: relative;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition:
    transform 0.22s var(--ease),
    box-shadow 0.22s var(--ease),
    border-color 0.22s ease;
}

.folder-card:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.folder-card:hover,
.folder-card:focus-within {
  z-index: 2;
}

.folder-card:has(.folder-menu-pop:not([hidden])) {
  z-index: 6;
}

.folder-card-link {
  display: flex;
  min-height: 92px;
  align-items: center;
  gap: 13px;
  padding: 14px 15px;
  border-radius: 14px;
}

.folder-art {
  display: grid;
  width: 50px;
  height: 50px;
  flex: none;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(155deg, #fff8e7, #ffeec4);
}

.folder-art svg {
  width: 38px;
  height: auto;
  filter: drop-shadow(0 2px 3px rgba(176, 122, 18, 0.2));
  transition: transform 0.24s var(--ease);
}

.folder-card:hover .folder-art svg {
  transform: translateY(-1px) scale(1.04);
}

.folder-card-main {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  gap: 4px;
}

.folder-open {
  display: grid;
  width: 26px;
  height: 26px;
  flex: none;
  place-items: center;
  border-radius: 50%;
  color: var(--muted-2);
  transition:
    color 0.18s ease,
    transform 0.2s var(--ease);
}

.folder-open .icon {
  width: 15px;
  height: 15px;
}

.folder-card:hover .folder-open {
  color: var(--ink-soft);
  transform: translateX(2px);
}

.folder-card:has(.folder-menu) .folder-card-main {
  padding-right: 28px;
}

.folder-card:has(.folder-menu) .folder-open {
  display: none;
}

.folder-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 72% 18%, #f9fcfa, transparent 54%),
    linear-gradient(135deg, #e5eeeb, #f4f7f6);
  color: #96aea5;
}

.folder-placeholder .icon {
  width: 38px;
  height: 38px;
  opacity: 0.58;
}

.folder-menu {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 4;
}

.folder-menu-btn {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 8px;
  color: var(--muted);
  transition:
    background 0.16s ease,
    color 0.16s ease;
}

.folder-menu-btn:hover {
  background: var(--surface-tint);
  color: var(--ink);
}

.folder-menu-pop {
  position: absolute;
  top: 34px;
  right: 0;
  width: 142px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow-md);
  animation: pop 0.16s var(--ease);
}

.menu-btn {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 8px;
  padding: 8px 9px;
  border-radius: 6px;
  color: var(--ink-soft);
  font-size: 0.78125rem;
  text-align: left;
}

.menu-btn:hover {
  background: var(--surface-soft);
}

.menu-btn .icon {
  width: 14px;
  height: 14px;
  color: var(--muted);
}

.menu-btn--danger {
  color: var(--danger);
}

.menu-btn--danger .icon {
  color: var(--danger);
}

.menu-btn--danger:hover {
  background: var(--danger-soft);
}

.folder-title {
  overflow: hidden;
  margin: 0;
  color: var(--ink);
  font-size: 0.90625rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.folder-card-link:hover .folder-title {
  color: var(--accent-strong);
}

.folder-desc {
  display: -webkit-box;
  overflow: hidden;
  margin: 0;
  color: var(--muted);
  font-size: 0.71875rem;
  line-height: 1.6;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
}

.folder-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px 11px;
  color: var(--muted);
  font-size: 0.6875rem;
}

.meta-item {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 4px;
}

.meta-item .icon {
  width: 12px;
  height: 12px;
  flex: none;
  color: var(--muted-2);
}

.meta-item--upload {
  color: var(--accent-strong);
  font-weight: 600;
}

.meta-item--upload .icon {
  color: var(--accent-strong);
}

/* Announcements */
.announcement-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  padding: 13px 15px;
  border: 1px solid #efe3c9;
  border-radius: 13px;
  background: linear-gradient(120deg, #fffaf0, #fffdf8 58%);
  box-shadow: var(--shadow-sm);
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.2s var(--ease);
}

.announcement-banner:hover {
  border-color: #e6d3ab;
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.announcement-banner-icon {
  display: grid;
  width: 36px;
  height: 36px;
  flex: none;
  place-items: center;
  border-radius: 10px;
  background: #fbecc9;
  color: #a9741a;
}

.announcement-banner-icon .icon {
  width: 17px;
  height: 17px;
}

.announcement-banner-copy {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  gap: 2px;
}

.announcement-banner-top {
  display: flex;
  align-items: center;
  gap: 8px;
}

.announcement-kicker {
  color: #9a6b17;
  font-size: 0.65625rem;
  font-weight: 650;
  letter-spacing: 0.08em;
}

.announcement-banner-time {
  margin-left: auto;
  color: var(--muted-2);
  font-size: 0.65625rem;
}

.announcement-banner-copy strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 0.84375rem;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.announcement-banner-copy p {
  overflow: hidden;
  margin: 0;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.6;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.announcement-banner-arrow {
  color: var(--muted-2);
  transition:
    color 0.18s ease,
    transform 0.2s var(--ease);
}

.announcement-banner:hover .announcement-banner-arrow {
  color: var(--ink-soft);
  transform: translateX(2px);
}

.announcement-feed {
  display: grid;
  max-width: 900px;
  gap: 12px;
}

.announcement-card {
  padding: 17px 19px 15px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.announcement-card.is-pinned {
  border-color: #ecdcb8;
  background: linear-gradient(180deg, #fffdf7, #fff);
}

.announcement-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.announcement-title-wrap {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.announcement-title-wrap h2 {
  margin: 0;
  font-size: 1.03125rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  line-height: 1.4;
}

.announcement-pin {
  display: inline-flex;
  height: 20px;
  align-items: center;
  gap: 4px;
  padding: 0 7px;
  border-radius: 99px;
  background: #fbecc9;
  color: #96651e;
  font-size: 0.625rem;
  font-weight: 650;
}

.announcement-pin .icon {
  width: 11px;
  height: 11px;
}

.announcement-actions {
  display: flex;
  flex: none;
  gap: 2px;
}

.announcement-body {
  margin: 9px 0 0;
  color: var(--ink-soft);
  font-size: 0.8125rem;
  line-height: 1.8;
  white-space: pre-wrap;
}

.announcement-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-top: 13px;
  padding-top: 11px;
  border-top: 1px solid #f0f3f2;
  color: var(--muted);
  font-size: 0.6875rem;
}

/* Messages */
.messages-layout {
  display: grid;
  height: calc(100vh - 215px);
  min-height: 470px;
  max-height: 760px;
  grid-template-columns: minmax(255px, 305px) minmax(0, 1fr);
  gap: 16px;
}

.message-list-panel {
  display: flex;
  min-width: 0;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.message-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 15px;
  border-bottom: 1px solid var(--line);
}

.message-list-head h2 {
  margin: 0;
  font-size: 0.90625rem;
  font-weight: 650;
}

.message-list-head p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.6875rem;
}

.conversation-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px;
  overscroll-behavior: contain;
}

.conversation-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px;
  border-radius: 10px;
  transition: background 0.16s ease;
}

.conversation-item:hover {
  background: var(--surface-soft);
}

.conversation-item.is-active {
  background: var(--surface-tint);
}

.conversation-avatar {
  width: 33px;
  height: 33px;
  font-size: 0.8125rem;
}

.conversation-main {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  gap: 2px;
}

.conversation-top {
  display: flex;
  align-items: center;
  gap: 8px;
}

.conversation-top strong {
  overflow: hidden;
  flex: 1;
  color: var(--ink);
  font-size: 0.8125rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation-time {
  flex: none;
  color: var(--muted-2);
  font-size: 0.625rem;
}

.conversation-preview {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.71875rem;
  line-height: 1.5;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation-unread {
  display: inline-grid;
  min-width: 17px;
  height: 17px;
  flex: none;
  place-items: center;
  padding: 0 5px;
  border-radius: 99px;
  background: var(--accent);
  color: #fff;
  font-size: 0.625rem;
  font-weight: 650;
}

.conversation-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 36px 16px;
  color: var(--muted);
  text-align: center;
}

.conversation-empty .icon {
  width: 24px;
  height: 24px;
  margin-bottom: 2px;
  color: var(--muted-2);
}

.conversation-empty p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.78125rem;
  font-weight: 600;
}

.conversation-empty span {
  font-size: 0.6875rem;
  line-height: 1.6;
}

.message-thread {
  display: flex;
  min-width: 0;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.thread-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 15px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.thread-back {
  display: none;
  width: 30px;
  height: 30px;
  flex: none;
  place-items: center;
  border-radius: 8px;
  color: var(--muted);
}

.thread-back:hover {
  background: var(--surface-tint);
  color: var(--ink);
}

.thread-head .avatar {
  width: 33px;
  height: 33px;
  font-size: 0.8125rem;
}

.thread-contact {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 1px;
}

.thread-contact strong {
  overflow: hidden;
  font-size: 0.84375rem;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.thread-contact span {
  color: var(--muted);
  font-size: 0.65625rem;
}

.thread-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 9px;
  overflow-y: auto;
  padding: 16px 15px 18px;
  background: linear-gradient(180deg, #fbfcfc, #fff 160px);
  overscroll-behavior: contain;
}

.message-day {
  display: flex;
  justify-content: center;
  margin: 2px 0 1px;
}

.message-day span {
  padding: 2px 8px;
  border-radius: 99px;
  background: #eef2f1;
  color: var(--muted);
  font-size: 0.625rem;
}

.message-row {
  display: flex;
  align-items: flex-end;
  gap: 7px;
}

.message-row.is-mine {
  justify-content: flex-end;
}

.message-avatar {
  width: 24px;
  height: 24px;
  margin-bottom: 15px;
  font-size: 0.625rem;
}

.message-bubble-wrap {
  display: flex;
  max-width: 74%;
  min-width: 0;
  flex-direction: column;
  gap: 3px;
}

.message-row.is-mine .message-bubble-wrap {
  align-items: flex-end;
}

.message-bubble {
  padding: 8px 11px;
  border-radius: 12px 12px 12px 4px;
  background: #f0f4f3;
  color: var(--ink);
  font-size: 0.78125rem;
  line-height: 1.65;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.message-row.is-mine .message-bubble {
  border-radius: 12px 12px 4px 12px;
  background: var(--accent);
  color: #fff;
}

.message-meta {
  padding: 0 2px;
  color: var(--muted-2);
  font-size: 0.59375rem;
}

.thread-empty {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 30px;
  color: var(--muted);
  text-align: center;
}

.thread-empty .icon {
  width: 26px;
  height: 26px;
  color: var(--muted-2);
}

.thread-empty p {
  margin: 0;
  font-size: 0.75rem;
}

.thread-placeholder {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 40px 24px;
  text-align: center;
}

.thread-placeholder .empty-icon {
  margin-bottom: 2px;
}

.thread-placeholder h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 650;
}

.thread-placeholder p {
  max-width: 300px;
  margin: 0;
  color: var(--muted);
  font-size: 0.78125rem;
  line-height: 1.7;
}

.thread-placeholder .btn {
  margin-top: 6px;
}

.message-composer {
  padding: 10px 13px 12px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.composer-box {
  padding: 4px 6px 4px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #fbfcfb;
  transition:
    border-color 0.16s ease,
    box-shadow 0.16s ease,
    background 0.16s ease;
}

.composer-box:focus-within {
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.09);
}

.composer-input {
  display: block;
  width: 100%;
  min-height: 38px;
  max-height: 120px;
  padding: 6px 2px;
  border: 0;
  outline: none;
  resize: none;
  background: transparent;
  font-size: 0.78125rem;
  line-height: 1.6;
}

.composer-input::placeholder {
  color: #a9b3af;
}

.composer-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 7px;
}

.composer-count {
  color: var(--muted-2);
  font-size: 0.625rem;
}

.composer-disabled {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 12px 15px;
  border-top: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.6875rem;
}

.composer-disabled .icon {
  width: 13px;
  height: 13px;
}

.contact-picker-wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.contact-picker {
  display: flex;
  max-height: 330px;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
  padding: 3px;
  margin: 0 -3px;
}

.contact-option {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 9px;
  border-radius: 9px;
  color: var(--ink);
  text-align: left;
}

.contact-option:hover {
  background: var(--surface-soft);
}

.contact-option .avatar {
  width: 32px;
  height: 32px;
  font-size: 0.78125rem;
}

.contact-option-main {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
}

.contact-option-main strong {
  overflow: hidden;
  font-size: 0.78125rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contact-option-main span {
  color: var(--muted);
  font-size: 0.65625rem;
}

.contact-picker-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 28px 16px;
  color: var(--muted);
}

.contact-picker-empty .icon {
  width: 22px;
  height: 22px;
  color: var(--muted-2);
}

.contact-picker-empty p {
  margin: 0;
  font-size: 0.75rem;
}

/* Empty states */
.empty-panel {
  display: flex;
  min-height: 280px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 11px;
  padding: 48px 24px;
  border: 1px dashed var(--line-strong);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.62);
  text-align: center;
}

.empty-panel--wide {
  grid-column: 1 / -1;
}

.empty-icon {
  display: grid;
  width: 50px;
  height: 50px;
  margin-bottom: 2px;
  place-items: center;
  border: 1px solid var(--accent-line);
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--accent);
}

.empty-icon .icon {
  width: 22px;
  height: 22px;
}

.empty-panel h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.empty-panel p {
  max-width: 380px;
  margin: 0;
  color: var(--muted);
  font-size: 0.78125rem;
  line-height: 1.75;
}

.empty-panel .btn {
  margin-top: 7px;
}

/* Folder detail */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 16px;
  padding: 4px 0;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 500;
}

.back-link:hover {
  color: var(--ink);
}

.back-link .icon {
  width: 14px;
  height: 14px;
}

.folder-head-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 14px;
}

.gallery-shell {
  margin-top: 24px;
}

.gallery-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 0.71875rem;
}

.gallery-topline strong {
  color: var(--ink-soft);
  font-weight: 600;
}

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

.photo-tile {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  width: 100%;
  aspect-ratio: 4 / 3;
  border: 1px solid rgba(21, 32, 29, 0.05);
  border-radius: 11px;
  background: #e7ecea;
  cursor: zoom-in;
  text-align: left;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.photo-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.96);
  pointer-events: none;
  transition: transform 0.5s var(--ease);
}

.photo-tile:hover img {
  transform: scale(1.035);
}

.photo-tile-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(180deg, transparent 46%, rgba(6, 12, 10, 0.82) 100%);
  opacity: 0.92;
  pointer-events: none;
}

.photo-tile-copy {
  position: absolute;
  right: 11px;
  bottom: 10px;
  left: 11px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 2px;
  color: #f4f8f6;
  pointer-events: none;
}

.photo-tile-name {
  overflow: hidden;
  font-size: 0.8125rem;
  font-weight: 550;
  line-height: 1.4;
  text-overflow: ellipsis;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.32);
  white-space: nowrap;
}

.photo-tile-sub {
  display: flex;
  align-items: center;
  gap: 7px;
  color: rgba(235, 245, 241, 0.78);
  font-size: 0.6875rem;
}

.photo-expiry {
  position: absolute;
  top: 9px;
  left: 9px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 6px;
  border: 1px solid rgba(168, 67, 45, 0.28);
  border-radius: 6px;
  background: rgba(243, 226, 200, 0.94);
  backdrop-filter: blur(6px);
  color: #9c3a24;
  font-size: 0.59375rem;
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(58, 30, 10, 0.14);
  pointer-events: none;
}

.photo-expiry .icon {
  width: 10px;
  height: 10px;
}

.photo-expiry--soon {
  border-color: rgba(168, 67, 45, 0.42);
  background: rgba(238, 205, 173, 0.97);
  color: #8b2c18;
}

.skeleton-tile {
  aspect-ratio: 4 / 3;
  border-radius: 11px;
}

.gallery-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 50px 20px;
  color: var(--muted);
  font-size: 0.75rem;
}

.gallery-more {
  display: flex;
  justify-content: center;
  margin-top: 22px;
}

.drop-hint {
  margin-top: 18px;
  color: var(--muted-2);
  font-size: 0.6875rem;
  text-align: center;
}

.drop-active {
  outline: 2px dashed var(--accent-line);
  outline-offset: 4px;
  border-radius: 14px;
  background: var(--accent-soft);
}

/* Panels and tables */
.panel {
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.panel-head h2 {
  margin: 0;
  font-size: 0.90625rem;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.panel-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.71875rem;
  line-height: 1.55;
}

.panel-body {
  padding: 20px;
}

.table-wrap {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.625rem;
  font-weight: 650;
  letter-spacing: 0.1em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

.data-table td {
  padding: 13px 14px;
  border-bottom: 1px solid #eff2f1;
  font-size: 0.78125rem;
  vertical-align: middle;
}

.data-table tr:last-child td {
  border-bottom: 0;
}

.data-table tbody tr {
  transition: background 0.15s ease;
}

.data-table tbody tr:hover {
  background: #fbfcfb;
}

.user-cell {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
}

.user-cell-name {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 1px;
}

.user-cell-name strong {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--ink);
  font-size: 0.78125rem;
  font-weight: 600;
}

.user-cell-name span {
  color: var(--muted);
  font-size: 0.65625rem;
}

.self-tag {
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--surface-tint);
  color: var(--accent);
  font-size: 0.5625rem;
  font-weight: 600;
}

.role-cell {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
}

.folder-access {
  max-width: 210px;
  color: var(--ink-soft);
  font-size: 0.71875rem;
  line-height: 1.55;
}

.folder-access-quota {
  display: block;
  margin-top: 2px;
  color: var(--muted-2);
  font-size: 0.6875rem;
}

.folder-access.is-empty {
  color: var(--muted-2);
}

.login-cell {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.login-cell strong {
  color: var(--ink-soft);
  font-size: 0.75rem;
  font-weight: 600;
}

.login-cell span {
  color: var(--muted);
  font-size: 0.65625rem;
}

.ip-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ip-cell .mono {
  color: var(--ink-soft);
}

.ip-cell span {
  color: var(--muted-2);
  font-size: 0.625rem;
}

.row-actions {
  display: flex;
  justify-content: flex-end;
  gap: 1px;
}

.row-actions .icon-btn {
  width: 29px;
  height: 29px;
  color: var(--muted);
}

.row-actions .icon-btn:hover {
  background: var(--surface-tint);
  color: var(--ink);
}

.row-actions .icon-btn--danger:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

.table-footnote {
  padding: 11px 16px;
  border-top: 1px solid var(--line);
  color: var(--muted-2);
  font-size: 0.65625rem;
  line-height: 1.5;
}

/* Site appearance */
.theme-picker,
.sidebar-picker {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.theme-choice,
.text-choice,
.font-choice,
.scale-choice,
.sidebar-choice {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
  cursor: pointer;
  transition: border-color .18s ease, background .18s ease, box-shadow .18s ease;
}

.theme-choice input,
.text-choice input,
.font-choice input,
.scale-choice input,
.sidebar-choice input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.theme-choice:has(input:checked),
.text-choice:has(input:checked),
.font-choice:has(input:checked),
.scale-choice:has(input:checked),
.sidebar-choice:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 1px var(--accent);
}

.theme-choice:has(input:focus-visible),
.text-choice:has(input:focus-visible),
.font-choice:has(input:focus-visible),
.scale-choice:has(input:focus-visible),
.sidebar-choice:has(input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.theme-swatch {
  width: 22px;
  height: 22px;
  flex: none;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
}

.sidebar-swatch {
  width: 20px;
  height: 20px;
  flex: none;
  border: 1px solid rgba(15, 24, 21, 0.14);
  border-radius: 6px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}

.theme-name {
  color: var(--ink-soft);
  font-size: 0.78125rem;
}

.text-picker {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.text-swatch {
  width: 18px;
  height: 18px;
  flex: none;
  border: 1px solid rgba(15, 24, 21, 0.12);
  border-radius: 50%;
}

.font-picker {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.font-choice {
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  padding: 9px 10px;
}

.font-sample {
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.35;
}

.font-choice[data-font-preview="serif"] .font-sample {
  font-family: var(--font-serif);
}

.font-choice[data-font-preview="kai"] .font-sample {
  font-family: var(--font-kai);
}

.font-choice[data-font-preview="rounded"] .font-sample {
  font-family: var(--font-rounded);
}

.font-name {
  color: var(--muted);
  font-size: 0.75rem;
}

.scale-picker {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.scale-choice {
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  padding: 8px 6px;
}

.scale-letter {
  color: var(--ink);
  font-weight: 650;
  line-height: 1;
}

.scale-choice:nth-child(1) .scale-letter {
  font-size: 0.9375rem;
}

.scale-choice:nth-child(2) .scale-letter {
  font-size: 1.0625rem;
}

.scale-choice:nth-child(3) .scale-letter {
  font-size: 1.1875rem;
}

.scale-choice:nth-child(4) .scale-letter {
  font-size: 1.3125rem;
}

.scale-name {
  color: var(--muted);
  font-size: 0.75rem;
}

.background-field {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.background-preview {
  display: grid;
  overflow: hidden;
  height: 128px;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  background: var(--surface-soft);
  place-items: center;
}

.background-preview.has-image {
  border-style: solid;
}

.background-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.background-empty {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  color: var(--muted-2);
  font-size: 0.78125rem;
  text-align: center;
}

.background-empty .icon {
  width: 20px;
  height: 20px;
}

.background-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.sidebar-background-field {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.sidebar-background-field .background-preview {
  width: 96px;
  height: 128px;
  flex: none;
}

.sidebar-background-field .background-empty {
  flex-direction: column;
  gap: 5px;
  padding: 0 8px;
}

.sidebar-background-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

/* Profile */
.profile-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
  align-items: start;
  gap: 18px;
}

.profile-col {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 18px;
}

.profile-col .login-history {
  margin-top: 0;
}

.profile-hero {
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 22px;
}

.profile-identity {
  display: flex;
  align-items: center;
  gap: 15px;
}

.profile-identity-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 3px;
}

.profile-identity-copy h2 {
  margin: 0;
  overflow: hidden;
  font-size: 1.25rem;
  font-weight: 650;
  letter-spacing: -0.025em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-identity-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 0.71875rem;
}

.profile-identity-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  margin-top: 4px;
}

.profile-stats {
  display: grid;
  overflow: hidden;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--line);
  gap: 1px;
}

.profile-stat {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 4px;
  padding: 13px 14px;
  background: var(--surface);
}

.profile-stat span {
  color: var(--muted);
  font-size: 0.625rem;
}

.profile-stat strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 0.875rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-stat small {
  color: var(--muted-2);
  font-size: 0.59375rem;
}

.form-panel {
  padding: 21px;
}

.form-panel h2 {
  margin: 0;
  font-size: 0.90625rem;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.form-panel > p {
  margin: 6px 0 19px;
  color: var(--muted);
  font-size: 0.71875rem;
  line-height: 1.65;
}

.stack-form {
  display: grid;
  gap: 14px;
}

.login-history {
  margin-top: 18px;
}

.login-history .panel-head {
  align-items: center;
}

.login-history .panel-head .chip {
  height: 23px;
}

/* Menus and misc */
.hr {
  height: 1px;
  margin: 4px 0;
  border: 0;
  background: var(--line);
}

.text-danger {
  color: var(--danger);
}

.text-warning {
  color: var(--warning);
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  overflow-y: auto;
  align-items: center;
  justify-content: center;
  padding: 22px;
  background: rgba(11, 16, 14, 0.47);
  backdrop-filter: blur(4px);
  animation: fadeIn 0.18s ease;
}

.modal {
  position: relative;
  display: flex;
  width: 100%;
  max-width: 560px;
  max-height: calc(100vh - 44px);
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 17px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.24s var(--ease);
}

.modal--sm {
  max-width: 430px;
}

.modal--lg {
  max-width: 760px;
}

.modal--xl {
  max-width: 880px;
}

.modal-head {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 20px 22px 0;
}

.modal-head-copy {
  min-width: 0;
  flex: 1;
}

.modal-head h2 {
  margin: 0;
  font-size: 1.0625rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.35;
}

.modal-head p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.71875rem;
  line-height: 1.6;
}

.modal-close {
  display: grid;
  width: 30px;
  height: 30px;
  flex: none;
  margin-top: -3px;
  margin-right: -4px;
  place-items: center;
  border-radius: 7px;
  color: var(--muted);
}

.modal-close:hover {
  background: var(--surface-soft);
  color: var(--ink);
}

.modal-close .icon {
  width: 17px;
  height: 17px;
}

.modal-body {
  overflow-y: auto;
  padding: 20px 22px;
}

.modal-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 13px 22px;
  border-top: 1px solid var(--line);
  background: var(--surface-soft);
}

.modal-foot--split {
  justify-content: space-between;
}

.confirm-copy {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.8125rem;
  line-height: 1.75;
}

.confirm-copy strong {
  color: var(--ink);
  font-weight: 600;
}

.confirm-copy .danger-note {
  display: block;
  margin-top: 8px;
  padding: 9px 10px;
  border-radius: 7px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 0.71875rem;
  line-height: 1.6;
}

/* Toasts */
.toast-stack {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 200;
  display: flex;
  width: min(360px, calc(100vw - 32px));
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow-md);
  color: var(--ink-soft);
  font-size: 0.78125rem;
  line-height: 1.55;
  pointer-events: auto;
  animation: toastIn 0.26s var(--ease);
}

.toast.is-leaving {
  animation: toastOut 0.2s ease forwards;
}

.toast .icon {
  width: 15px;
  height: 15px;
  margin-top: 1px;
  color: var(--accent);
}

.toast--error .icon {
  color: var(--danger);
}

.toast--warning .icon {
  color: var(--warning);
}

.toast-copy {
  flex: 1;
  min-width: 0;
}

/* Upload */
.upload-zone {
  display: flex;
  min-height: 150px;
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 22px;
  border: 1px dashed var(--line-strong);
  border-radius: 11px;
  background: var(--surface-soft);
  text-align: center;
  transition:
    border-color 0.16s ease,
    background 0.16s ease;
}

.upload-zone:hover,
.upload-zone.is-dragging {
  border-color: var(--accent-line);
  background: var(--accent-soft);
}

.upload-zone-icon {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid var(--accent-line);
  border-radius: 11px;
  background: var(--surface);
  color: var(--accent);
}

.upload-zone-icon .icon {
  width: 19px;
  height: 19px;
}

.upload-zone strong {
  color: var(--ink-soft);
  font-size: 0.8125rem;
  font-weight: 600;
}

.upload-zone span {
  color: var(--muted);
  font-size: 0.6875rem;
  line-height: 1.6;
}

.upload-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.65625rem;
  line-height: 1.6;
}

.upload-meta .icon {
  width: 12px;
  height: 12px;
  color: var(--muted-2);
}

.upload-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: 16px;
}

.upload-list:empty {
  display: none;
}

.upload-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
}

.upload-thumb {
  display: grid;
  width: 40px;
  height: 40px;
  flex: none;
  overflow: hidden;
  place-items: center;
  border-radius: 6px;
  background: var(--surface-tint);
  color: var(--muted);
}

.upload-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.upload-thumb .icon {
  width: 17px;
  height: 17px;
}

.upload-item-copy {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  gap: 3px;
}

.upload-item-name {
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 0.71875rem;
  font-weight: 550;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-item-sub {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 0.625rem;
}

.upload-progress {
  overflow: hidden;
  height: 3px;
  border-radius: 99px;
  background: var(--surface-tint);
}

.upload-progress span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 0.18s ease;
}

.upload-remove {
  display: grid;
  width: 26px;
  height: 26px;
  flex: none;
  place-items: center;
  border-radius: 6px;
  color: var(--muted);
}

.upload-remove:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

.upload-remove .icon {
  width: 14px;
  height: 14px;
}

.upload-status {
  color: var(--muted);
  font-size: 0.625rem;
  white-space: nowrap;
}

.upload-status.is-done {
  color: var(--accent);
}

.upload-status.is-error {
  color: var(--danger);
}

/* Viewer */
.viewer {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(ellipse at 50% 35%, rgba(33, 53, 46, 0.34), transparent 62%),
    #090d0c;
  color: #eef4f1;
  animation: viewerIn 0.22s ease;
}

.viewer-head {
  z-index: 3;
  display: flex;
  height: 60px;
  flex: 0 0 auto;
  align-items: center;
  gap: 13px;
  padding: 0 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.065);
  background: rgba(9, 13, 12, 0.78);
  backdrop-filter: blur(14px);
}

.viewer-title {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  gap: 1px;
}

.viewer-title strong {
  overflow: hidden;
  font-size: 0.78125rem;
  font-weight: 550;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.viewer-title span {
  color: rgba(238, 244, 241, 0.42);
  font-size: 0.625rem;
  letter-spacing: 0.02em;
}

.viewer-actions {
  display: flex;
  flex: none;
  align-items: center;
  gap: 3px;
}

.viewer-btn {
  display: grid;
  width: 33px;
  height: 33px;
  place-items: center;
  border: 1px solid rgba(221, 194, 156, 0.42);
  border-radius: 8px;
  background: rgba(243, 226, 200, 0.92);
  color: var(--warm-red);
  transition:
    background 0.16s ease,
    color 0.16s ease;
}

.viewer-btn:hover {
  background: var(--warm-sand-strong);
  color: var(--warm-red-strong);
}

.viewer-btn--danger:hover {
  background: #f2c9b9;
  color: #8f2417;
}

.viewer-btn .icon {
  width: 17px;
  height: 17px;
}

.viewer-stage {
  position: relative;
  min-height: 0;
  flex: 1;
  overflow: hidden;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.viewer-canvas {
  position: absolute;
  inset: clamp(18px, 3vw, 38px) clamp(18px, 7vw, 108px);
  border-radius: 2px;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  filter: drop-shadow(0 26px 45px rgba(0, 0, 0, 0.35));
  transition: opacity 0.2s ease;
}

.viewer-canvas.is-loading {
  opacity: 0.25;
}

.viewer-shield {
  position: absolute;
  inset: 0;
  z-index: 3;
  cursor: default;
}

.viewer-watermark {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  overflow: hidden;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-rows: minmax(70px, 1fr);
  opacity: 0.14;
  pointer-events: none;
  mix-blend-mode: screen;
}

.viewer-watermark span {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  transform: rotate(-22deg);
  white-space: nowrap;
}

.viewer-nav {
  position: absolute;
  top: 50%;
  z-index: 5;
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid rgba(221, 194, 156, 0.45);
  border-radius: 50%;
  background: rgba(243, 226, 200, 0.94);
  backdrop-filter: blur(8px);
  color: var(--warm-red);
  transform: translateY(-50%);
  transition:
    background 0.16s ease,
    opacity 0.16s ease;
}

.viewer-nav:hover {
  background: var(--warm-sand-strong);
}

.viewer-nav[disabled] {
  opacity: 0.16;
  pointer-events: none;
}

.viewer-nav .icon {
  width: 19px;
  height: 19px;
}

.viewer-nav--prev {
  left: 16px;
}

.viewer-nav--next {
  right: 16px;
}

.viewer-loader {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  color: rgba(238, 244, 241, 0.48);
  font-size: 0.6875rem;
}

.viewer-loader .spinner {
  width: 16px;
  height: 16px;
  border-color: rgba(255, 255, 255, 0.14);
  border-top-color: #9fd5c4;
}

.viewer-foot {
  z-index: 3;
  display: flex;
  min-height: 62px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 11px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.065);
  background: rgba(9, 13, 12, 0.82);
  backdrop-filter: blur(14px);
}

.viewer-details {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 16px;
  color: rgba(238, 244, 241, 0.46);
  font-size: 0.65625rem;
}

.viewer-details .meta-item {
  gap: 5px;
}

.viewer-details .meta-item .icon {
  color: rgba(238, 244, 241, 0.3);
}

.viewer-guard {
  display: flex;
  flex: none;
  align-items: center;
  gap: 5px;
  color: rgba(238, 244, 241, 0.34);
  font-size: 0.625rem;
  white-space: nowrap;
}

.viewer-guard .icon {
  width: 12px;
  height: 12px;
}

.viewer-empty {
  display: flex;
  height: 100%;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: rgba(238, 244, 241, 0.44);
}

.viewer-empty .icon {
  width: 28px;
  height: 28px;
}

.viewer-empty strong {
  color: #eef4f1;
  font-size: 0.875rem;
  font-weight: 600;
}

.viewer-empty span {
  max-width: 340px;
  padding: 0 20px;
  font-size: 0.75rem;
  line-height: 1.7;
  text-align: center;
}

/* Login records */
.record-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.record-summary .chip {
  height: 26px;
}

.record-device {
  max-width: 260px;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.65625rem;
  line-height: 1.5;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.record-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.65625rem;
  font-weight: 600;
}

.record-status .dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}

.record-status--failed {
  color: var(--danger);
}

.record-status--failed .dot {
  background: var(--danger);
}

.modal-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 250px;
  color: var(--muted);
  font-size: 0.75rem;
}

.noscript {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--surface);
  color: var(--ink);
  font-size: 0.9375rem;
  text-align: center;
}

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

@keyframes shimmer {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: -100% 0;
  }
}

@keyframes pop {
  from {
    opacity: 0;
    transform: translateY(-3px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

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

@keyframes toastOut {
  to {
    opacity: 0;
    transform: translateY(4px);
  }
}

@keyframes viewerIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Responsive */
@media (max-width: 1180px) {
  .profile-grid {
    grid-template-columns: minmax(0, 1fr) minmax(300px, 0.9fr);
  }

  .folder-grid {
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  }
}

@media (max-width: 1020px) {
  .profile-grid {
    grid-template-columns: 1fr;
  }

  .profile-stats {
    max-width: 540px;
  }
}

@media (max-width: 960px) {
  .shell {
    display: block;
  }

  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: min(86vw, 300px);
    height: 100%;
    border-right: 0;
    box-shadow: none;
    transform: translateX(-104%);
    transition: transform 0.28s var(--ease);
  }

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

  .nav-backdrop {
    position: fixed;
    inset: 0;
    z-index: 48;
    display: block;
    background: rgba(8, 14, 12, 0.42);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.24s ease;
  }

  .nav-backdrop.is-open {
    opacity: 1;
    pointer-events: auto;
  }

  .mobile-topbar {
    position: sticky;
    top: 0;
    z-index: 45;
    display: flex;
    height: 58px;
    align-items: center;
    gap: 10px;
    padding: 0 16px;
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(14px);
  }

  .mobile-brand {
    display: flex;
    min-width: 0;
    flex: 1;
    align-items: center;
    gap: 9px;
    color: var(--ink);
    font-size: 0.90625rem;
    font-weight: 650;
    letter-spacing: -0.01em;
  }

  .mobile-brand .brand-mark {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    font-size: 0.875rem;
  }

  .mobile-avatar {
    border: 0;
    cursor: pointer;
  }

  .mobile-message-link {
    position: relative;
    display: inline-grid;
    width: 34px;
    height: 34px;
    flex: none;
    place-items: center;
    border-radius: 9px;
    color: var(--ink-soft);
    transition: background 0.16s ease;
  }

  .mobile-message-link:hover {
    background: var(--surface-tint);
  }

  .mobile-message-link .icon {
    width: 18px;
    height: 18px;
  }

  .mobile-message-link .nav-badge {
    position: absolute;
    top: -2px;
    right: -3px;
    display: grid;
    min-width: 16px;
    height: 16px;
    margin: 0;
    padding: 0 4px;
    place-items: center;
    border: 2px solid var(--surface);
    font-size: 0.5625rem;
    line-height: 1;
  }

  .messages-layout {
    height: calc(100dvh - 230px);
    min-height: 430px;
    max-height: 720px;
    grid-template-columns: minmax(240px, 280px) minmax(0, 1fr);
  }

  .content {
    padding: 24px 18px 52px;
  }

  .page-head {
    margin-bottom: 22px;
  }

  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  }

  .data-table thead {
    display: none;
  }

  .data-table,
  .data-table tbody {
    display: block;
  }

  .table-wrap {
    padding: 12px 12px 2px;
  }

  .data-table tr {
    display: grid;
    overflow: hidden;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-bottom: 10px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: var(--surface);
  }

  .data-table tbody tr:hover {
    background: var(--surface);
  }

  .data-table tr:last-child {
    margin-bottom: 0;
  }

  .data-table td {
    display: flex;
    min-width: 0;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    border-bottom: 1px solid #eff2f1;
  }

  .data-table td::before {
    content: attr(data-label);
    flex: none;
    color: var(--muted);
    font-size: 0.625rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    white-space: nowrap;
  }

  .data-table td:first-child {
    grid-column: 1 / -1;
    background: var(--surface-soft);
  }

  .data-table td:first-child::before,
  .data-table td:last-child::before {
    display: none;
  }

  .data-table td:last-child {
    grid-column: 1 / -1;
    justify-content: flex-end;
    border-bottom: 0;
  }

  .data-table--records td:last-child {
    justify-content: space-between;
  }

  .data-table--records td:last-child::before {
    display: block;
  }

  .data-table td .user-cell {
    width: 100%;
  }

  .folder-access {
    max-width: none;
  }

  .login-history .table-wrap {
    padding-top: 12px;
  }
}

@media (max-width: 760px) {
  .content {
    padding: 21px 15px 46px;
  }

  .page-head {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
  }

  .page-actions {
    flex-wrap: wrap;
    padding-bottom: 0;
  }

  .page-actions .btn {
    flex: 0 0 auto;
  }

  .folder-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .folder-card-link {
    min-height: 84px;
    gap: 12px;
    padding: 12px 13px;
  }

  .folder-art {
    width: 46px;
    height: 46px;
  }

  .folder-art svg {
    width: 35px;
  }

  .folder-title {
    font-size: 0.84375rem;
  }

  .folder-meta {
    gap: 4px 9px;
    font-size: 0.65625rem;
  }

  .folder-menu {
    top: 8px;
    right: 8px;
  }

  .folder-menu-btn {
    width: 26px;
    height: 26px;
  }

  .announcement-banner {
    gap: 10px;
    padding: 11px 12px;
    margin-bottom: 14px;
  }

  .announcement-banner-icon {
    width: 32px;
    height: 32px;
  }

  .announcement-banner-copy strong {
    font-size: 0.78125rem;
  }

  .announcement-banner-copy p {
    font-size: 0.71875rem;
  }

  .announcement-card {
    padding: 15px 15px 13px;
  }

  .announcement-title-wrap h2 {
    font-size: 0.96875rem;
  }

  .announcement-body {
    font-size: 0.78125rem;
  }

  .messages-layout {
    height: calc(100dvh - 260px);
    min-height: 380px;
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .messages-layout:not(.is-thread-open) .message-thread {
    display: none;
  }

  .messages-layout.is-thread-open .message-list-panel {
    display: none;
  }

  .thread-back {
    display: inline-grid;
  }

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

  .profile-hero {
    padding: 18px;
  }

  .profile-stats {
    gap: 0;
    grid-template-columns: 1fr;
    background: var(--line);
  }

  .profile-stat {
    flex-direction: row;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 13px;
  }

  .profile-stat strong {
    font-size: 0.8125rem;
    text-align: right;
  }

  .profile-stat small {
    display: none;
  }

  .viewer-watermark {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .viewer-canvas {
    inset: 12px 12px 20px;
  }

  .viewer-nav--prev {
    left: 8px;
  }

  .viewer-nav--next {
    right: 8px;
  }

  .viewer-nav {
    width: 36px;
    height: 36px;
  }

  .viewer-foot {
    align-items: flex-start;
    flex-direction: column;
    gap: 7px;
    padding: 10px 14px;
  }

  .viewer-head {
    height: 55px;
    padding: 0 12px;
  }

  .viewer-details {
    gap: 5px 12px;
    font-size: 0.625rem;
  }

  .viewer-guard {
    font-size: 0.5625rem;
  }

  .modal-backdrop {
    align-items: flex-end;
    padding: 0;
  }

  .modal {
    max-width: none;
    max-height: 92vh;
    border-radius: 17px 17px 0 0;
    border-bottom: 0;
  }

  .modal-head {
    padding: 18px 18px 0;
  }

  .modal-body {
    padding: 18px;
  }

  .modal-foot {
    padding: 12px 18px max(12px, env(safe-area-inset-bottom));
  }

  .toast-stack {
    right: 16px;
    bottom: max(16px, env(safe-area-inset-bottom));
    left: 16px;
    width: auto;
  }
}

@media (max-width: 560px) {
  .auth {
    padding: 28px 18px;
  }

  .auth-head h2 {
    font-size: 1.5rem;
  }

  .folder-grid {
    gap: 9px;
  }

  .folder-card-link {
    min-height: 78px;
    gap: 11px;
    padding: 11px 12px;
  }

  .folder-art {
    width: 42px;
    height: 42px;
    border-radius: 10px;
  }

  .folder-art svg {
    width: 32px;
  }

  .folder-meta .meta-item--access {
    display: none;
  }

  .announcement-banner-time {
    display: none;
  }

  .announcement-banner-arrow {
    display: none;
  }

  .announcement-card {
    padding: 14px 13px 12px;
  }

  .announcement-foot {
    gap: 5px 10px;
    font-size: 0.65625rem;
  }

  .messages-layout {
    height: calc(100dvh - 300px);
    min-height: 340px;
  }

  .message-list-head {
    padding: 12px 13px;
  }

  .thread-head {
    padding: 10px 12px;
  }

  .thread-body {
    padding: 13px 12px 15px;
  }

  .message-bubble-wrap {
    max-width: 82%;
  }

  .message-composer {
    padding: 9px 10px 10px;
  }

  .gallery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
  }

  .photo-tile {
    aspect-ratio: 1.18 / 1;
    border-radius: 9px;
  }

  .photo-tile-copy {
    right: 8px;
    bottom: 7px;
    left: 8px;
  }

  .photo-tile-name {
    font-size: 0.71875rem;
  }

  .photo-tile-sub {
    font-size: 0.625rem;
  }

  .photo-tile-sub span:last-child {
    display: none;
  }

  .photo-expiry {
    top: 7px;
    left: 7px;
    padding: 2px 5px;
    font-size: 0.5625rem;
  }

  .empty-panel {
    min-height: 230px;
    padding: 36px 18px;
  }

  .perm-row {
    flex-direction: column;
    align-items: stretch;
    gap: 7px;
  }

  .perm-toggle {
    flex: 1;
    justify-content: center;
  }

  .modal-head h2 {
    font-size: 1rem;
  }

  .panel-head {
    padding: 15px 16px;
  }

  .panel-body {
    padding: 16px;
  }

  .upload-zone {
    min-height: 135px;
  }

  .page-actions .btn {
    flex: 1 1 100%;
    min-width: 0;
  }

  .page-actions .btn--icon {
    flex: none;
  }

  .row-actions {
    gap: 6px;
  }

  .profile-identity {
    align-items: flex-start;
  }

  .profile-identity .avatar--lg {
    width: 54px;
    height: 54px;
    border-radius: 15px;
    font-size: 1.1875rem;
  }

  .theme-picker,
  .sidebar-picker {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .text-picker {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .scale-picker {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .background-preview {
    height: 108px;
  }

  .sidebar-background-field .background-preview {
    width: 84px;
    height: 112px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
  }
}
