:root {
  --bg: #f6f1e8;
  --panel: rgba(255, 250, 242, 0.84);
  --panel-strong: rgba(255, 251, 246, 0.97);
  --text: #1f2c36;
  --muted: #566674;
  --line: rgba(25, 47, 66, 0.12);
  --navy: #173f5f;
  --teal: #1f7a8c;
  --amber: #f6ae2d;
  --clay: #f26419;
  --warm: #f7d08a;
  --mint: #d9f0e3;
  --shadow: 0 20px 60px rgba(31, 44, 54, 0.12);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(246, 174, 45, 0.18), transparent 36%),
    radial-gradient(circle at right 20%, rgba(31, 122, 140, 0.18), transparent 26%),
    linear-gradient(180deg, #fefbf7 0%, var(--bg) 100%);
}

body.modal-open {
  overflow: hidden;
}

.backdrop {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 10% 10%, rgba(242, 100, 25, 0.12), transparent 24%),
    radial-gradient(circle at 90% 20%, rgba(246, 174, 45, 0.12), transparent 20%);
}

.panel {
  background: var(--panel);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}

.auth-shell {
  position: relative;
  width: min(560px, calc(100vw - 28px));
  margin: 70px auto 32px;
  animation: fade-up 0.7s ease;
}

.auth-card {
  padding: 34px;
}

.shell {
  position: relative;
  width: min(1380px, calc(100vw - 32px));
  margin: 24px auto 48px;
  display: grid;
  gap: 22px;
  animation: fade-up 0.7s ease;
}

.hero {
  position: relative;
  z-index: 20;
  overflow: visible;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  padding: 32px;
}

.hero-copy {
  max-width: 720px;
}

.hero-actions {
  display: flex;
  gap: 12px;
  align-items: end;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.profile-shell {
  position: relative;
}

.profile-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  border: 0;
  border-radius: 999px;
  background: rgba(23, 63, 95, 0.08);
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.profile-trigger:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 24px rgba(23, 63, 95, 0.14);
}

.profile-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: inset 0 0 0 1px rgba(23, 63, 95, 0.08);
}

.profile-avatar-large {
  width: 60px;
  height: 60px;
}

.profile-avatar-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-menu {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  width: min(280px, calc(100vw - 32px));
  padding: 10px;
  z-index: 60;
}

.profile-menu-item {
  width: 100%;
  display: grid;
  gap: 4px;
  padding: 14px 16px;
  border: 0;
  border-radius: 16px;
  background: transparent;
  color: var(--navy);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.18s ease, transform 0.18s ease;
}

.profile-menu-item + .profile-menu-item {
  margin-top: 6px;
}

.profile-menu-item:hover {
  background: rgba(23, 63, 95, 0.08);
  transform: translateY(-1px);
}

.profile-menu-item-title {
  font-weight: 800;
  font-size: 0.96rem;
}

.profile-menu-item-meta {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.45;
}

.profile-menu-item-logout {
  color: #a24d11;
  font-weight: 800;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 110;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(23, 34, 43, 0.32);
  backdrop-filter: blur(8px);
}

.profile-modal,
.workspace-modal {
  overflow: auto;
  padding: 28px;
}

.profile-modal {
  width: min(760px, calc(100vw - 32px));
  max-height: min(88vh, 880px);
}

.workspace-modal {
  width: min(1180px, calc(100vw - 32px));
  max-height: min(90vh, 940px);
}

.workspace-modal-compact {
  width: min(920px, calc(100vw - 32px));
}

.profile-modal-head,
.workspace-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 16px;
}

.profile-modal-close {
  min-width: 104px;
}

.profile-modal-body,
.workspace-modal-body {
  margin-top: 18px;
}

.workspace-modal-body {
  display: grid;
  gap: 18px;
}

.workspace-modal .admin-dashboard,
.workspace-modal .directory-panel,
.workspace-modal .admin-card,
.workspace-modal .user-card,
.workspace-modal .directory-card {
  scroll-margin-top: 18px;
}

.profile-summary {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(23, 63, 95, 0.1);
}

.profile-copy {
  flex: 1;
}

.profile-feedback {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(23, 63, 95, 0.12);
  background: rgba(23, 63, 95, 0.06);
  color: var(--navy);
  font-weight: 700;
  line-height: 1.5;
}

.profile-feedback[data-tone="error"] {
  border-color: rgba(185, 58, 12, 0.18);
  background: rgba(185, 58, 12, 0.08);
  color: #8b3007;
}

.profile-feedback[data-tone="success"] {
  border-color: rgba(24, 90, 57, 0.16);
  background: rgba(24, 90, 57, 0.08);
  color: #185a39;
}

.profile-section {
  margin-top: 18px;
}

.profile-section + .profile-section {
  padding-top: 18px;
  border-top: 1px solid rgba(23, 63, 95, 0.1);
}

.profile-section-header {
  margin-bottom: 14px;
}

.profile-form {
  gap: 16px;
}

.avatar-picker {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 12px;
}

.avatar-option {
  position: relative;
  cursor: pointer;
}

.avatar-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.avatar-option-card {
  display: grid;
  gap: 8px;
  justify-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 252, 247, 0.9);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.avatar-option-custom .avatar-option-card {
  background: linear-gradient(145deg, rgba(241, 248, 245, 0.98), rgba(255, 252, 247, 0.94));
}

.avatar-option-card img {
  width: 72px;
  height: 72px;
  border-radius: 16px;
  object-fit: cover;
  box-shadow: 0 10px 18px rgba(23, 63, 95, 0.12);
}

.avatar-option-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--navy);
}

.avatar-option:hover .avatar-option-card {
  transform: translateY(-1px);
  box-shadow: 0 14px 22px rgba(23, 63, 95, 0.1);
}

.avatar-option input:checked + .avatar-option-card {
  border-color: rgba(31, 122, 140, 0.65);
  box-shadow: 0 0 0 4px rgba(31, 122, 140, 0.12);
}

.avatar-upload-row {
  display: flex;
  gap: 12px;
  margin-top: 14px;
}

.avatar-upload-hint {
  margin-top: 10px;
}

.profile-security {
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: rgba(246, 174, 45, 0.14);
  color: #7a4a00;
}

.profile-logout {
  width: 100%;
  margin-top: 14px;
}

.eyebrow {
  margin: 0 0 8px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--teal);
}

h1,
h2,
h3 {
  margin: 0;
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  font-weight: 700;
  line-height: 1.05;
}

h1 {
  font-size: clamp(2.3rem, 5vw, 4.4rem);
}

h2 {
  font-size: clamp(1.4rem, 3vw, 2rem);
}

h3 {
  font-size: 1.1rem;
}

.subtitle,
.stat-detail,
.empty-state p:last-child,
.setup-note p,
.muted-note,
.code-block {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.setup-note {
  margin-top: 22px;
  padding: 18px;
  border-radius: var(--radius-lg);
  background: rgba(23, 63, 95, 0.06);
  border: 1px dashed rgba(23, 63, 95, 0.16);
}

.code-block {
  white-space: pre-wrap;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: rgba(23, 63, 95, 0.08);
  font-family: "SFMono-Regular", Menlo, Monaco, Consolas, monospace;
  font-size: 0.92rem;
}

.account-cluster {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.account-pill {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-radius: 999px;
  background: rgba(23, 63, 95, 0.08);
}

.account-name {
  margin: 0;
  font-weight: 800;
}

.account-meta {
  margin: 3px 0 0;
  font-size: 0.84rem;
  color: var(--muted);
}

.role-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 800;
  line-height: 1.25;
  text-align: center;
  white-space: normal;
  word-break: break-word;
  text-transform: none;
  letter-spacing: 0.02em;
}

.role-admin {
  background: rgba(246, 174, 45, 0.22);
  color: #744400;
}

.role-member {
  background: rgba(31, 122, 140, 0.14);
  color: var(--teal);
}

.field-span-2 {
  grid-column: 1 / -1;
}

.password-panel {
  padding: 24px 28px;
}

.password-action {
  display: flex;
  align-items: end;
}

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

.stat-card {
  padding: 24px;
}

.accent-card {
  background: linear-gradient(140deg, rgba(31, 122, 140, 0.94), rgba(23, 63, 95, 0.94));
  color: #fefefe;
}

.accent-card .stat-label,
.accent-card .stat-detail {
  color: rgba(255, 255, 255, 0.84);
}

.stat-label {
  margin: 0;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.stat-value {
  margin: 18px 0 10px;
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 800;
}

.quarter-band {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
  padding: 26px 28px;
  background:
    linear-gradient(120deg, rgba(255, 251, 246, 0.98), rgba(240, 249, 246, 0.9)),
    var(--panel);
}

.quarter-tabs {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.quarter-tab,
.button {
  border: 0;
  border-radius: 999px;
  font: inherit;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.quarter-tab {
  padding: 13px 22px;
  background: rgba(23, 63, 95, 0.08);
  color: var(--navy);
  font-weight: 700;
}

.quarter-tab:hover,
.button:hover {
  transform: translateY(-1px);
}

.quarter-tab.is-active {
  background: linear-gradient(120deg, var(--amber), #ffd07c);
  box-shadow: 0 12px 26px rgba(246, 174, 45, 0.28);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(430px, 0.95fr) minmax(430px, 1.05fr);
  gap: 22px;
}

.composer,
.ledger {
  padding: 28px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 16px;
  margin-bottom: 22px;
}

.compact-header {
  margin-bottom: 16px;
}

.entry-form,
.member-form {
  display: grid;
  gap: 18px;
}

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

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

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

.field {
  display: grid;
  gap: 8px;
}

.password-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.password-input-row input {
  min-width: 0;
}

.password-toggle {
  min-width: 78px;
  padding: 13px 16px;
}

.field-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.field span {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--navy);
}

.field.compact span {
  font-size: 0.8rem;
  letter-spacing: 0.02em;
}

input,
select,
textarea {
  width: 100%;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--panel-strong);
  color: var(--text);
  font: inherit;
  padding: 14px 16px;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

textarea {
  resize: vertical;
  min-height: 120px;
  line-height: 1.55;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(31, 122, 140, 0.6);
  box-shadow: 0 0 0 4px rgba(31, 122, 140, 0.12);
}

input:disabled,
select:disabled,
textarea:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.rich-editor {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--panel-strong);
  overflow: hidden;
}

.editor-toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: rgba(23, 63, 95, 0.05);
}

.editor-toolbar.is-disabled {
  opacity: 0.65;
}

.editor-tool {
  min-width: 0;
  padding: 8px 11px;
  border: 1px solid rgba(23, 63, 95, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--navy);
  font: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.1;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.18s ease, transform 0.18s ease;
}

.editor-tool:hover:not(:disabled) {
  background: rgba(246, 174, 45, 0.18);
}

.editor-tool:disabled {
  cursor: not-allowed;
  opacity: 0.7;
}

.editor-surface {
  min-height: 168px;
  padding: 16px;
  line-height: 1.6;
  outline: none;
}

.editor-surface:focus {
  box-shadow: inset 0 0 0 2px rgba(31, 122, 140, 0.22);
}

.editor-surface.is-empty::before {
  content: attr(data-placeholder);
  color: rgba(86, 102, 116, 0.78);
  pointer-events: none;
}

.editor-surface p,
.editor-surface blockquote,
.editor-surface h3,
.editor-surface ul,
.editor-surface ol {
  margin: 0 0 12px;
}

.editor-surface p:last-child,
.editor-surface blockquote:last-child,
.editor-surface h3:last-child,
.editor-surface ul:last-child,
.editor-surface ol:last-child {
  margin-bottom: 0;
}

.editor-surface h3 {
  color: var(--navy);
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.editor-surface blockquote {
  padding: 10px 14px;
  border-left: 3px solid rgba(31, 122, 140, 0.5);
  background: rgba(31, 122, 140, 0.07);
  border-radius: 0 14px 14px 0;
  color: var(--navy);
}

.editor-surface ul,
.editor-surface ol {
  padding-left: 22px;
}

.editor-surface.is-readonly {
  background: rgba(23, 63, 95, 0.03);
  color: var(--text);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 20px;
  font-weight: 700;
  text-decoration: none;
}

.button-primary {
  background: linear-gradient(120deg, var(--navy), #245c83);
  color: #fff;
  box-shadow: 0 14px 26px rgba(23, 63, 95, 0.26);
}

.button-secondary {
  background: linear-gradient(120deg, var(--amber), #ffd07c);
  color: #2b2b2b;
}

.button-ghost {
  background: rgba(23, 63, 95, 0.08);
  color: var(--navy);
}

.button-inline {
  padding: 9px 14px;
  background: rgba(23, 63, 95, 0.08);
  color: var(--navy);
}

.field-label-row .button-inline {
  padding: 8px 12px;
}

.form-helper {
  margin-top: 0;
  font-size: 0.84rem;
}

.form-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.upload-note {
  margin-top: -6px;
}

.admin-dashboard {
  padding: 30px;
  background:
    linear-gradient(135deg, rgba(255, 252, 247, 0.98), rgba(243, 250, 247, 0.92)),
    var(--panel);
}

.admin-dashboard-header {
  margin-bottom: 0;
}

.admin-grid {
  margin-top: 18px;
  display: grid;
  grid-template-columns: minmax(280px, 0.8fr) minmax(420px, 1.2fr);
  gap: 18px;
  align-items: start;
}

.admin-grid-single {
  grid-template-columns: 1fr;
}

.admin-card {
  padding: 26px;
  border-radius: 24px;
  border: 1px solid rgba(23, 63, 95, 0.1);
  background:
    linear-gradient(150deg, rgba(255, 255, 255, 0.7), rgba(255, 250, 242, 0.96)),
    rgba(255, 252, 247, 0.92);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.admin-card-login {
  background:
    linear-gradient(150deg, rgba(241, 249, 247, 0.98), rgba(255, 252, 245, 0.94)),
    rgba(255, 252, 247, 0.92);
}

.admin-card-access {
  background:
    linear-gradient(150deg, rgba(246, 249, 252, 0.98), rgba(255, 252, 245, 0.94)),
    rgba(255, 252, 247, 0.92);
}

.admin-card-wide {
  grid-column: 1 / -1;
}

.admin-card-note {
  margin-top: 10px;
  max-width: 56ch;
}

.ledger-filters {
  display: grid;
  grid-template-columns: 1fr 1fr 1.3fr;
  gap: 14px;
}

.entry-list {
  margin-top: 20px;
  display: grid;
  gap: 14px;
}

.pagination {
  margin-top: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.pagination-center {
  display: grid;
  gap: 10px;
  justify-items: center;
  flex: 1;
}

.pagination-summary {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.pagination-pages {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.pagination-button,
.pagination-page {
  border: 0;
  border-radius: 999px;
  background: rgba(23, 63, 95, 0.08);
  color: var(--navy);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.pagination-button {
  padding: 11px 16px;
}

.pagination-page {
  min-width: 40px;
  padding: 9px 12px;
}

.pagination-page.is-active {
  background: linear-gradient(120deg, var(--amber), #ffd07c);
  box-shadow: 0 10px 18px rgba(246, 174, 45, 0.22);
}

.pagination-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.entry-card,
.user-card,
.directory-card {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255, 252, 247, 0.92);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.entry-card {
  cursor: pointer;
}

.entry-card:hover,
.user-card:hover,
.directory-card:hover {
  transform: translateY(-2px);
  border-color: rgba(23, 63, 95, 0.2);
  box-shadow: 0 18px 28px rgba(23, 63, 95, 0.12);
}

.entry-card.is-active {
  border-color: rgba(23, 63, 95, 0.28);
  background:
    linear-gradient(135deg, rgba(255, 252, 247, 0.98), rgba(237, 246, 243, 0.92)),
    rgba(255, 252, 247, 0.92);
  box-shadow: 0 22px 34px rgba(23, 63, 95, 0.14);
}

.entry-card-top,
.entry-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.entry-name,
.user-card-name,
.directory-card-name {
  margin: 0;
  font-weight: 800;
  font-size: 1.02rem;
  line-height: 1.28;
}

.entry-meta,
.user-card-meta,
.directory-card-designation {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.entry-preview {
  margin: 16px 0;
  line-height: 1.6;
  color: var(--text);
}

.source-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(31, 122, 140, 0.08);
  color: var(--teal);
  font-weight: 700;
  font-size: 0.86rem;
}

.user-list {
  display: grid;
  gap: 16px;
}

.access-list {
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
}

.user-card {
  display: grid;
  gap: 16px;
  min-width: 0;
  background:
    linear-gradient(155deg, rgba(255, 252, 247, 0.98), rgba(241, 248, 245, 0.92)),
    rgba(255, 252, 247, 0.92);
}

.user-card-top {
  min-width: 0;
}

.user-card-identity {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  min-width: 0;
}

.user-avatar-shell,
.directory-avatar-shell {
  display: inline-flex;
  width: 58px;
  height: 58px;
  border-radius: 18px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: inset 0 0 0 1px rgba(23, 63, 95, 0.08);
  flex-shrink: 0;
}

.user-avatar,
.directory-avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.user-card-main,
.directory-card-main {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.user-card-copy,
.directory-card-copy {
  display: grid;
  gap: 4px;
  align-content: start;
  min-width: 0;
}

.user-card-line {
  margin: 0;
  color: var(--navy);
  font-size: 0.94rem;
  font-weight: 700;
  line-height: 1.45;
}

.user-card-name {
  overflow-wrap: break-word;
}

.user-card-meta {
  overflow-wrap: break-word;
}

.user-card-details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.user-card-detail {
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(23, 63, 95, 0.08);
  background: rgba(23, 63, 95, 0.05);
}

.user-card-detail-wide {
  grid-column: 1 / -1;
}

.user-card-label {
  margin: 0 0 7px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.user-role-badge {
  align-self: start;
  justify-self: start;
  width: fit-content;
  max-width: 100%;
  padding-inline: 16px;
}

.directory-panel {
  padding: 30px;
}

#directoryModal .directory-panel {
  padding: 8px 0 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.directory-list {
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
  align-items: start;
}

.directory-card {
  display: grid;
  gap: 18px;
  min-width: 0;
  background:
    linear-gradient(155deg, rgba(255, 252, 247, 0.98), rgba(240, 247, 250, 0.92)),
    rgba(255, 252, 247, 0.92);
}

.directory-card-top {
  min-width: 0;
}

.directory-card-identity {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  min-width: 0;
}

.directory-card-main {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.directory-card-copy {
  display: grid;
  gap: 4px;
  align-content: start;
  min-width: 0;
}

.directory-card-name,
.directory-card-designation,
.directory-card-line,
.directory-card-label {
  margin: 0;
}

.directory-card-name {
  font-size: 1.08rem;
  line-height: 1.24;
  word-break: normal;
  overflow-wrap: break-word;
}

.directory-card-designation {
  line-height: 1.45;
  word-break: normal;
  overflow-wrap: break-word;
}

.directory-card-details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.directory-card-detail {
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(23, 63, 95, 0.08);
  background: rgba(23, 63, 95, 0.05);
}

.directory-card-detail-wide {
  grid-column: 1 / -1;
}

.directory-card-label {
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.directory-card-line {
  color: var(--navy);
  font-size: 0.94rem;
  line-height: 1.45;
  font-weight: 700;
}

.directory-role-badge {
  align-self: start;
  justify-self: start;
  width: fit-content;
  max-width: 100%;
  padding-inline: 16px;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 14px;
  border-radius: 999px;
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
  white-space: normal;
}

#currentUserRole,
.user-role-badge,
.directory-role-badge {
  max-width: min(100%, 220px);
}

.badge-soft {
  background: rgba(23, 63, 95, 0.08);
  color: var(--navy);
}

.badge-solid {
  background: rgba(217, 240, 227, 1);
  color: #185a39;
}

.badge-warm {
  background: rgba(246, 174, 45, 0.2);
  color: #825100;
}

.empty-state {
  padding: 28px;
  border: 1px dashed rgba(23, 63, 95, 0.22);
  border-radius: var(--radius-lg);
  background: rgba(255, 251, 246, 0.82);
}

.compact-empty {
  padding: 18px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: 360px;
  padding: 14px 18px;
  border-radius: 16px;
  background: rgba(23, 63, 95, 0.96);
  color: #fff;
  box-shadow: 0 18px 40px rgba(23, 63, 95, 0.24);
}

.toast[data-tone="error"] {
  background: rgba(185, 58, 12, 0.96);
}

.toast[data-tone="success"] {
  background: rgba(24, 90, 57, 0.96);
}

.hidden {
  display: none !important;
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1180px) {
  .stats-grid,
  .workspace,
  .admin-grid,
  .three-up {
    grid-template-columns: 1fr;
  }

  .hero,
  .quarter-band {
    flex-direction: column;
    align-items: stretch;
  }

  .access-list {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  }

  .directory-list {
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  }
}

@media (max-width: 760px) {
  .shell,
  .auth-shell {
    width: min(100vw - 18px, 100%);
    margin-top: 10px;
  }

  .auth-card,
  .hero,
  .composer,
  .ledger,
  .admin-dashboard,
  .directory-panel,
  .quarter-band,
  .password-panel {
    padding: 22px;
  }

  .two-up,
  .ledger-filters,
  .user-card-details,
  .directory-card-details {
    grid-template-columns: 1fr;
  }

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

  .password-toggle {
    width: 100%;
  }

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

  .avatar-upload-row {
    flex-direction: column;
  }

  .hero-actions,
  .form-actions,
  .pagination,
  .entry-card-top,
  .entry-card-footer,
  .user-card-top,
  .user-card-identity,
  .directory-card-identity,
  .account-cluster {
    flex-direction: column;
    align-items: stretch;
  }

  .directory-card-top {
    grid-template-columns: 1fr;
  }

  .user-card-identity {
    grid-template-columns: 1fr;
  }

  .directory-card-identity {
    grid-template-columns: 1fr;
  }

  .user-role-badge,
  .directory-role-badge {
    justify-self: start;
  }

  .button,
  .quarter-tab {
    width: 100%;
  }

  .profile-shell,
  .profile-trigger {
    width: 100%;
  }

  .profile-menu {
    position: static;
    width: 100%;
    margin-top: 12px;
  }

  .modal-backdrop {
    padding: 10px;
  }

  .profile-modal,
  .workspace-modal {
    width: calc(100vw - 20px);
    max-height: calc(100vh - 20px);
    padding: 22px;
  }

  .profile-modal-head,
  .workspace-modal-head {
    flex-direction: column;
    align-items: stretch;
  }

  .profile-modal-close {
    width: 100%;
  }

  .pagination-pages {
    justify-content: flex-start;
  }

  .user-card-detail-wide,
  .directory-card-detail-wide {
    grid-column: auto;
  }
}
