@font-face {
  font-family: 'IBM Plex Sans';
  src: url('/fonts/IBMPlexSans-Regular.woff2') format('woff2');
  font-style: normal; font-weight: 400; font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Sans';
  src: url('/fonts/IBMPlexSans-SemiBold.woff2') format('woff2');
  font-style: normal; font-weight: 600; font-display: swap;
}
:root {
  --ui-font: 'IBM Plex Sans', sans-serif;
  --paper: #f1f4f2;
  --ink: #193139;
  --muted: #607179;
  --line: #d6e0de;
  --card: #fff;
  --strong: #175966;
  --amber: #bd754f;
  --shadow: 0 12px 32px #16303816;
}
html { background: var(--paper); }
html, body, button, input, select, textarea { font-family: var(--ui-font); }
.brand-icon { display: block; width: 44px; height: 44px; object-fit: contain; flex: none; border-radius: 12px; }
.auth-icon { width: 54px; height: 54px; }
.topbar-identity { display: flex; align-items: center; gap: .6rem; min-width: 0; font-weight: 600; color: var(--ink); }
.topbar-identity .brand-icon { width: 30px; height: 30px; border-radius: 8px; }
.profile-picker { display: flex; align-items: center; gap: .5rem; font-size: .75rem; color: var(--muted); white-space: nowrap; }
.profile-picker select { width: min(32vw, 250px); min-height: 38px; padding: .35rem .55rem; font-size: .85rem; color: var(--ink); }
.mfa-secret, .mfa-recovery { padding: 1rem; border-radius: 10px; background: #eef4f0; color: #153840; font: 600 1rem/1.6 ui-monospace, Consolas, monospace; letter-spacing: .08em; overflow-wrap: anywhere; white-space: pre-wrap; user-select: all; }
#space-owner { max-width: min(32vw, 250px); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.fine-count, .fine-unpaid { display: inline-block; border-radius: 6px; background: #f8e4d9; color: #8c382d; padding: .3rem .55rem; font-size: .8rem; font-weight: 600; }
.fine-count { margin-top: .4rem; }
.fine-paid { display: inline-block; border-radius: 6px; background: #e2efdf; color: #285b3a; padding: .3rem .55rem; font-size: .8rem; font-weight: 600; }
.fine-details { display: grid; gap: .35rem; min-width: 0; }
.fine-details small { color: var(--muted); }
.fine-details p { margin: 0; }
.fine-actions { display: flex; flex-wrap: wrap; gap: .45rem; }
#new-fine { margin: 1rem 0; }
#fine-form { border-top: 1px solid var(--line); padding-top: 1rem; }
.about-icon { width: 42px; height: 42px; float: right; }
.pending-fines { margin: 1.5rem 0 2rem; }
.pending-fines h2 { font-size: 1.3rem; margin-bottom: .8rem; }
.draft-slots { display: grid; gap: .8rem; margin: 1rem 0 1.5rem; }
.draft-slot { min-width: 0; padding: 1rem; border: 1px solid var(--line); border-radius: 14px; background: #fffdf9; }
.draft-slot strong { display: block; margin-bottom: .6rem; }
.draft-actions, .attachment-actions { display: flex; flex-wrap: wrap; gap: .55rem; align-items: center; }
.draft-preview { margin-top: .8rem; overflow-wrap: anywhere; }
.draft-preview img { display: block; max-width: 100%; max-height: 38vh; margin: .6rem auto; object-fit: contain; }
.draft-preview iframe { width: 100%; height: 38vh; border: 1px solid var(--line); border-radius: 8px; }
#editor-save-status { padding: .7rem 1rem; background: #f6e9d3; border-radius: 8px; }
#pending-attachment { width: 100%; }
@media (max-width: 760px) { dialog { max-height: calc(100dvh - env(safe-area-inset-bottom) - 1rem); padding-bottom: calc(1.4rem + env(safe-area-inset-bottom)); } .dialog-actions { position: sticky; bottom: -.1rem; background: var(--card); padding-bottom: .25rem; } }
body { background: linear-gradient(180deg, #f7f9f8 0%, var(--paper) 65%); }
h1, h2, h3, .brand { font-family: var(--ui-font); font-weight: 600; letter-spacing: -.035em; }
.brand small { font-family: var(--ui-font); font-weight: 600; }
.eyebrow { color: #9b5b36; }
.auth-intro {
  background: linear-gradient(145deg, #dfeae7, #edf1ec);
  border-right: 1px solid var(--line);
}
.auth-intro em { color: var(--strong); }
.auth-card { border-radius: 18px; }
.brand-mark { border-radius: 4px 12px 4px 12px; }
.sidebar { background: #153840; border-right: 1px solid #0f2d34; }
.sidebar nav button { border-radius: 9px; }
.sidebar nav button.active { background: #e4efec; color: #183f48; font-weight: 600; }
.topbar { background: #ffffffed; }
.topbar-status { display: flex; align-items: center; gap: .55rem; }
.storage-badge { background: #e8f1ef; color: #164a55; border: 1px solid #cbdedc;
  border-radius: 99px; padding: .36rem .65rem; font-size: .75rem; font-weight: 700; }
.content { max-width: 1100px; }
.page-head { border-bottom: 1px solid #cfd9cb; padding-bottom: 1.2rem; }
.page-head h1 { font-size: clamp(2.1rem, 4vw, 3.25rem); }
.card { border-radius: 14px; box-shadow: 0 4px 16px #1630380d; }
.stat { background: #e1ece9; border-radius: 12px; border-left: 3px solid var(--strong); }
.stat strong { color: #124e46; font-family: var(--ui-font); font-weight: 600; letter-spacing: -.04em; }
.primary { border-radius: 9px; box-shadow: none; }
.list-row { border-radius: 11px; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid #bd754d; outline-offset: 2px;
}
.legal-links { margin-top: 1.2rem; font-size: .85rem; }
a { color: #155b4b; }
.storage-choice { display: flex; align-items: flex-start; gap: .8rem; padding: 1rem;
  margin: .7rem 0; border: 1px solid var(--line); border-radius: 12px; background: #f8faf3; }
.storage-choice input, .consent-check input { width: auto; margin-top: .15rem; accent-color: #155b4b; }
.storage-choice span { display: grid; gap: .35rem; }
.storage-choice small { color: var(--muted); font-size: .82rem; line-height: 1.5; }
.consent-check { display: flex; align-items: flex-start; gap: .7rem; margin: 1rem 0; line-height: 1.45; }
#storage-dialog { width: min(620px, calc(100vw - 1rem)); }
#storage-dialog p { margin: 1rem 0; }
#storage-dialog .notice { font-size: .85rem; }
.legal-page { min-height: 100vh; padding: clamp(1rem, 5vw, 4rem); }
.legal-page main { max-width: 800px; margin: 0 auto; background: #fffdf7; border: 1px solid var(--line);
  border-radius: 14px; padding: clamp(1.4rem, 5vw, 4rem); box-shadow: var(--shadow); }
.legal-page h1 { margin-bottom: 2rem; }
.legal-page h2 { margin-top: 2rem; }
.legal-page p { color: #384e49; }
.pricing-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.pricing-grid .card { padding: 1.2rem; }
.pricing-grid .price { font: 600 2rem var(--ui-font); color: var(--ink); }
.pricing-grid small { font: .85rem var(--ui-font); }
button, input:not([type=checkbox]):not([type=radio]), select { min-height: 44px; }
h1, h2, h3, .card, .list-row, .notice { overflow-wrap: anywhere; }
.attachment-description { display: grid; gap: .2rem; min-width: 0; }
.attachment-description small { color: var(--muted); overflow-wrap: anywhere; }
.attachment-row-actions, .attachment-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.attachment-row-actions button { flex: 0 0 auto; }
#attachment-form { display: grid; grid-template-columns: 1fr; align-items: stretch; gap: .8rem; margin: 1.2rem 0; }
#attachment-form label { min-width: 0; }
#attachment-form input[type=file] { min-width: 0; }
#attachment-preview { border-top: 1px solid var(--line); padding-top: 1rem; }
#attachment-preview:empty { display: none; }
#attachment-preview > a { display: inline-block; text-decoration: none; margin-bottom: .7rem; }
#attachment-preview img { border-radius: 10px; }
.dialog-actions { position: sticky; bottom: -.1rem; background: var(--card); z-index: 1; }
#storage-dialog .dialog-actions { position: static; }
.access-list { display: grid; gap: .9rem; margin-top: 1.2rem; }
.access-profile { margin-top: 1.6rem; }
.access-profile h2 { font-size: 1.45rem; }
.access-refresh { margin-left: .65rem; }
.access-card { min-width: 0; padding: 1.1rem; border: 1px solid var(--line); border-radius: 14px; background: var(--card); }
.access-card-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.access-identity { display: grid; gap: .25rem; min-width: 0; overflow-wrap: anywhere; }
.access-identity small { color: var(--muted); }
.access-toggle { display: inline-flex; align-items: center; gap: .55rem; font-size: .9rem; white-space: nowrap; }
.access-toggle input { appearance: none; position: relative; width: 2.7rem; height: 1.5rem; min-height: 0;
  margin: 0; border: 0; border-radius: 2rem; background: #aebbb5; cursor: pointer; transition: background .15s ease; }
.access-toggle input::before { content: ''; position: absolute; top: .2rem; left: .2rem; width: 1.1rem; height: 1.1rem;
  border-radius: 50%; background: white; box-shadow: 0 1px 3px #10292344; transition: transform .15s ease; }
.access-toggle input:checked { background: var(--strong); }
.access-toggle input:checked::before { transform: translateX(1.2rem); }
.access-toggle input:focus-visible { outline: 3px solid #d18c3e; outline-offset: 2px; }
.access-permissions { display: grid; grid-template-columns: repeat(auto-fit, minmax(175px, 1fr)); gap: .8rem; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.access-field { min-width: 0; }
.access-field select { min-width: 0; }
@media (max-width: 760px) {
  .auth-intro { min-height: 0; padding: .85rem 1rem .75rem; }
  .auth-intro h1 { display: none; }
  .auth-intro p:not(.auth-note) { display: none; }
  .auth-note { margin-top: .45rem; padding: .35rem .55rem; font-size: .72rem; }
  .auth-card { width: 100%; margin: 0 auto; border: 0; border-radius: 0; box-shadow: none; padding: 1rem; }
  .auth-card h2 { margin-top: .6rem; }
  .auth-card form { margin-top: .8rem; gap: .65rem; }
  .sidebar { border-right: 0; border-bottom: 1px solid #0f2d34; padding: .65rem .85rem .45rem; gap: .35rem; }
  .brand { font-size: 1.12rem; }
  .brand .brand-mark { width: 34px; height: 34px; }
  .brand small { display: none; }
  .sidebar select { padding: .35rem .6rem; min-height: 40px; }
  .sidebar nav { margin: .1rem -.85rem 0; padding: 0 .85rem .25rem; scroll-snap-type: x proximity; scrollbar-width: thin; }
  .sidebar nav button { padding: .55rem .8rem; min-height: 42px; scroll-snap-align: start; }
  .sidebar-bottom { display: flex; align-items: center; gap: .45rem; font-size: .7rem; margin-top: 0; }
  .sidebar-bottom span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .sidebar-bottom button { width: auto; white-space: nowrap; padding: .4rem; }
  .topbar { height: auto; min-height: 42px; gap: .4rem; padding: .35rem .85rem; }
  #breadcrumb { display: none; }
  .topbar-status { flex: 1; flex-wrap: wrap; justify-content: flex-end; min-width: 0; }
  .profile-picker { flex: 1 1 100%; justify-content: flex-end; }
  .profile-picker select { width: min(72vw, 270px); max-width: 100%; }
  #space-owner { max-width: min(48vw, 210px); }
  .storage-badge, .plan-badge { font-size: .68rem; padding: .25rem .5rem; }
  .content { padding: .9rem .85rem calc(1rem + env(safe-area-inset-bottom)); }
  .page-head { margin-bottom: 1rem; padding-bottom: .8rem; align-items: stretch; gap: .7rem; }
  .page-head h1 { font-size: clamp(1.75rem, 8vw, 2.35rem); line-height: 1.1; }
  .page-head p { font-size: .82rem; line-height: 1.35; }
  .page-head .primary { width: 100%; }
  .cards { grid-template-columns: minmax(0, 1fr); gap: .75rem; }
  .card { padding: 1rem; }
  .card-actions button { flex: 1 1 auto; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
  .stat { padding: .8rem; }
  .stat strong { font-size: 2rem; }
  .stat span { font-size: .7rem; letter-spacing: .04em; }
  .list-row { flex-wrap: wrap; padding: .8rem; }
  dialog { width: calc(100vw - 1rem); max-height: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 1rem); padding: 1rem; }
  dialog h2 { font-size: 1.3rem; }
  .form-grid { gap: .7rem; margin: .9rem 0; }
  .dialog-actions { padding-bottom: max(.65rem, env(safe-area-inset-bottom)); }
  .dialog-actions button { flex: 1 1 0; }
  .attachment-actions button { flex: 1 1 100%; }
  .attachment-row-actions { width: 100%; }
  .attachment-row-actions button { flex: 1 1 0; }
  .access-card { padding: .85rem; }
  .access-refresh { width: 100%; margin: .65rem 0 0; }
  .access-card-head { align-items: flex-start; }
  .access-permissions { grid-template-columns: minmax(0, 1fr); gap: .65rem; }
  #toast { left: .75rem; right: .75rem; bottom: calc(.75rem + env(safe-area-inset-bottom)); max-width: none; }
}
