:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --panel: #ffffff;
  --line: #dde3ec;
  --text: #253044;
  --muted: #667085;
  --brand: #23407a;
  --brand-2: #f2b441;
  --accent: #0e9f6e;
  --warning: #b7791f;
  --danger: #d92d20;
  --soft-blue: #eef4ff;
  --soft-green: #e9f8f1;
  --soft-yellow: #fff7e6;
  font-family:
    Inter, "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

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

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 248px 1fr;
}

.sidebar {
  background: #0f244a;
  color: white;
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  min-width: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--brand-2), #f6d36f);
  color: #10244a;
  display: grid;
  place-items: center;
  font-weight: 800;
}

.brand span,
small,
.eyebrow {
  color: var(--muted);
}

.sidebar .brand span {
  display: block;
  color: #cbd5e1;
  font-size: 13px;
  margin-top: 3px;
}

nav {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.nav-item {
  border: 0;
  border-radius: 7px;
  padding: 12px 14px;
  background: transparent;
  color: #dbe5f3;
  text-align: left;
}

.nav-item.active,
.nav-item:hover {
  background: #203d72;
  color: white;
}

.workspace {
  padding: 28px;
  min-width: 0;
}

.topbar,
.panel-header,
.dialog-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar {
  margin-bottom: 22px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 30px;
  line-height: 1.2;
}

h2 {
  font-size: 18px;
  line-height: 1.35;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 6px;
}

.topbar-actions,
.filter-bar,
.quick-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.filter-bar {
  justify-content: flex-end;
}

.filter-bar input {
  min-width: 260px;
}

.filter-bar select {
  width: auto;
  min-width: 150px;
}

.primary-button,
.secondary-button,
.quick-actions button,
.icon-button {
  border-radius: 7px;
  border: 1px solid var(--line);
  background: white;
  color: var(--text);
  min-height: 38px;
}

.primary-button {
  background: var(--brand);
  color: white;
  border-color: var(--brand);
  padding: 0 16px;
}

.secondary-button,
.quick-actions button {
  padding: 0 14px;
}

.icon-button {
  width: 38px;
  display: grid;
  place-items: center;
  font-size: 20px;
}

.quick-actions {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 18px;
}

.dashboard-search {
  padding: 14px 18px;
}

.dashboard-search label {
  grid-template-columns: 90px minmax(0, 1fr);
  align-items: center;
  color: var(--text);
  font-weight: 700;
}

.view {
  display: none;
}

.active-view {
  display: block;
}

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

.metric-grid article,
.panel,
.settings-grid article {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.metric-grid article {
  padding: 18px;
  display: grid;
  gap: 8px;
}

.metric-grid span {
  color: var(--muted);
  font-size: 13px;
}

.metric-grid strong {
  font-size: 30px;
}

.panel {
  padding: 18px;
  margin-bottom: 18px;
}

.overview-table {
  margin-top: 16px;
  border-top: 1px solid var(--line);
}

.records-table {
  display: grid;
  margin-top: 16px;
  border-top: 1px solid var(--line);
  overflow-x: hidden;
}

.table-row {
  display: grid;
  grid-template-columns: 1.1fr 1.4fr 1.1fr 1fr;
  gap: 14px;
  align-items: center;
  min-height: 66px;
  border-bottom: 1px solid var(--line);
}

.records-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  align-items: start;
  min-width: 0;
  border-bottom: 1px solid var(--line);
  padding: 12px 0;
}

.records-table.cols-2 .records-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.records-table.cols-3 .records-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.records-table.cols-5 .records-row { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.records-table.cols-6 .records-row { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.records-table.cols-7 .records-row { grid-template-columns: repeat(7, minmax(0, 1fr)); }
.records-table.cols-8 .records-row { grid-template-columns: repeat(8, minmax(0, 1fr)); }
.records-table.cols-9 .records-row { grid-template-columns: repeat(9, minmax(0, 1fr)); }
.records-table.cols-10 .records-row { grid-template-columns: repeat(10, minmax(0, 1fr)); }

.table-row > span {
  min-width: 0;
}

.records-row > span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.table-row small {
  display: block;
  margin-top: 4px;
}

.records-head {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  min-height: 38px;
}

.table-head {
  min-height: 42px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.clickable-client {
  cursor: pointer;
}

.clickable-client:hover,
.client-card:hover {
  background: #f8fbff;
}

.status-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-block;
  vertical-align: middle;
  margin-right: 10px;
  border: 1px solid #d7dde8;
  background: #e5e7eb;
}

.progress-25 {
  background: conic-gradient(var(--brand) 0 25%, #e5e7eb 25% 100%);
}

.progress-40 {
  background: conic-gradient(#6f55d9 0 40%, #e5e7eb 40% 100%);
}

.progress-50 {
  background: conic-gradient(#f2b441 0 50%, #e5e7eb 50% 100%);
}

.progress-75 {
  background: conic-gradient(var(--accent) 0 75%, #e5e7eb 75% 100%);
}

.progress-100 {
  background: var(--accent);
}

.not-started {
  background: #e5e7eb;
}

.closed {
  background: #111827;
}

.add-new-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #f3f4f6;
  color: #d97706;
  font-size: 14px;
  font-weight: 800;
  line-height: 1;
}

#clients-view {
  grid-template-columns: 1fr;
  gap: 18px;
}

#clients-view.active-view {
  display: grid;
}

.client-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.client-list-table {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow-x: hidden;
  background: white;
}

.client-list-row {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(145px, 1.1fr) minmax(0, 1.3fr) minmax(0, 1.05fr) minmax(0, 1fr) minmax(0, 0.9fr);
  gap: 12px;
  align-items: center;
  width: 100%;
  min-width: 0;
  padding: 13px 14px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: white;
  color: var(--text);
  text-align: left;
}

.client-list-row:last-child {
  border-bottom: 0;
}

.client-list-head {
  background: #f8fafc;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0;
}

.client-list-table .client-card {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(145px, 1.1fr) minmax(0, 1.3fr) minmax(0, 1.05fr) minmax(0, 1fr) minmax(0, 0.9fr);
  gap: 12px;
  border-radius: 0;
  min-height: 76px;
  cursor: pointer;
}

.client-list-table .client-card:hover {
  background: #f8fbff;
}

.client-list-table .client-card span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.client-list-table .client-card strong,
.client-list-table .client-card small {
  display: block;
}

.client-list-table .client-card small {
  color: var(--muted);
  margin-top: 3px;
  line-height: 1.35;
}

.client-name-cell,
.status-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}

.current-status-cell {
  display: grid;
  gap: 7px;
}

.current-status-cell > span {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
}

.quick-open-cell {
  border-radius: 6px;
  padding: 4px 2px;
}

.quick-open-cell:hover {
  background: #f1f5f9;
}

.client-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  margin-top: 16px;
}

.client-tabs button {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 12px 16px;
  border-bottom: 3px solid transparent;
}

.client-tabs button.active {
  color: var(--brand);
  border-bottom-color: var(--brand);
  font-weight: 700;
}

.client-tabs button.disabled {
  color: #98a2b3;
  cursor: not-allowed;
}

.client-tabs span {
  color: inherit;
  opacity: 0.75;
}

.client-list-meta {
  color: var(--muted);
  font-size: 13px;
  margin-top: 10px;
}

.client-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  min-height: 92px;
  padding: 12px;
  display: grid;
  grid-template-columns: 44px 1fr 36px;
  align-items: center;
  gap: 10px;
  text-align: left;
}

.client-card small + small {
  margin-top: 3px;
}

.client-card.active {
  border-color: var(--brand);
  background: var(--soft-blue);
}

.client-card.archived-card {
  opacity: 0.78;
  background: #f8fafc;
}

.avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: white;
  background: var(--brand);
  font-weight: 700;
  overflow: hidden;
}

.avatar img,
.photo-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.avatar.pink {
  background: #b83280;
}

.avatar.green {
  background: var(--accent);
}

.detail-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  overflow-x: hidden;
  border-bottom: 1px solid var(--line);
  margin: 0 -18px 18px;
  padding: 0 18px;
}

.client-detail-topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: -4px 0 16px;
}

.client-detail-topbar h2 {
  margin: 2px 0 0;
}

.detail-tabs button {
  border: 0;
  border-right: 1px solid var(--line);
  background: white;
  flex: 0 1 auto;
  padding: 12px 14px;
  color: var(--muted);
  line-height: 1.25;
  white-space: normal;
}

.detail-tabs button.active {
  color: var(--brand);
  font-weight: 700;
  box-shadow: inset 0 -3px 0 var(--brand);
}

.personal-grid,
.at-a-glance,
.application-layout,
.form-grid,
.settings-grid {
  display: grid;
  gap: 14px;
}

.personal-grid {
  grid-template-columns: 160px repeat(4, minmax(0, 1fr));
  align-items: start;
}

.photo-card {
  width: 132px;
  height: 154px;
  border-radius: 8px;
  background: linear-gradient(135deg, #dce6f7, #f9efe3);
  display: grid;
  place-items: center;
  color: var(--brand);
  font-size: 44px;
  font-weight: 800;
  overflow: hidden;
}

.compact-photo {
  width: 96px;
  height: 112px;
  font-size: 34px;
}

.client-profile-hero {
  display: grid;
  grid-template-columns: 112px 1fr auto;
  gap: 18px;
  align-items: center;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.client-hero-main {
  display: grid;
  gap: 7px;
}

.client-hero-main h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 22px;
}

.client-hero-main p {
  color: var(--muted);
}

.client-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.client-chips span {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  padding: 5px 9px;
  font-size: 12px;
  color: var(--text);
}

.client-hero-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.field-label {
  color: var(--muted);
  display: block;
  font-size: 12px;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.section-title {
  margin: 22px 0 12px;
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.at-a-glance {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.glance-item {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  min-height: 92px;
}

.glance-item strong {
  display: block;
  margin-bottom: 7px;
}

.application-layout {
  grid-template-columns: 1fr 1fr;
}

.timeline,
.notes-block {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.timeline ol {
  margin: 10px 0 0;
  padding-left: 20px;
}

.timeline li {
  margin-bottom: 10px;
}

.badge {
  display: inline-block;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 700;
  background: var(--soft-blue);
  color: var(--brand);
}

.badge.green {
  background: var(--soft-green);
  color: #027a48;
}

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

.badge.red {
  background: #fff1f3;
  color: var(--danger);
}

.badge.dark {
  background: #111827;
  color: white;
}

.client-dashboard {
  display: grid;
  gap: 14px;
}

.client-dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 14px;
}

.profile-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 12px;
}

.mini-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.mini-list p {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.muted-copy {
  color: var(--muted);
  margin-top: 12px;
}

.task-list {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.task {
  border: 1px solid var(--line);
  border-left: 4px solid var(--brand);
  border-radius: 8px;
  background: white;
  padding: 14px;
  display: grid;
  gap: 6px;
}

.task.urgent {
  border-left-color: var(--danger);
}

.task.warning {
  border-left-color: var(--warning);
}

.task span {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  font-weight: 700;
}

.settings-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 16px;
}

.settings-grid article {
  padding: 16px;
  min-height: 104px;
  display: grid;
  gap: 8px;
}

.empty-state {
  margin-top: 16px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 16px;
  color: var(--muted);
  background: #f8fafc;
}

input,
select,
textarea {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px 11px;
  width: 100%;
  min-width: 0;
}

input[readonly] {
  background: #f4f6fa;
  color: var(--muted);
}

[hidden] {
  display: none !important;
}

.country-select-native {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  padding: 0;
  opacity: 0;
  pointer-events: none;
}

.flag-select {
  position: relative;
  width: 100%;
}

.flag-select-trigger,
.flag-select-option {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  width: 100%;
  border: 1px solid var(--line);
  background: white;
  color: var(--text);
  text-align: left;
}

.flag-select-trigger.has-flag {
  grid-template-columns: 24px minmax(0, 1fr) auto;
}

.flag-select-trigger {
  min-height: 42px;
  border-radius: 7px;
  padding: 9px 11px;
}

.flag-select-trigger.placeholder {
  color: #778399;
}

.flag-select.invalid .flag-select-trigger {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(228, 41, 72, 0.1);
}

.flag-select-trigger span,
.flag-select-option span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.country-flag,
.flag-placeholder {
  width: 22px;
  height: 15px;
  border-radius: 2px;
  border: 1px solid rgba(15, 36, 74, 0.12);
  background: #eef2f7;
  object-fit: cover;
}

.flag-select-chevron {
  justify-self: end;
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid var(--muted);
}

.flag-select-menu {
  position: absolute;
  z-index: 40;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 276px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: 0 18px 42px rgba(15, 36, 74, 0.18);
  padding: 4px;
}

.flag-select-option {
  grid-template-columns: minmax(0, 1fr);
  border: 0;
  border-radius: 6px;
  min-height: 38px;
  padding: 8px 10px;
}

.flag-select-option.has-flag {
  grid-template-columns: 24px minmax(0, 1fr);
}

.flag-select-option:hover,
.flag-select-option[aria-selected="true"] {
  background: #eef6ff;
  color: var(--brand);
}

.flag-select-option:disabled {
  cursor: not-allowed;
  color: #a3adbd;
  background: #f7f9fc;
}

.phone-field {
  display: grid;
  grid-template-columns: minmax(142px, 0.55fr) minmax(0, 1fr);
  gap: 8px;
}

.phone-field select,
.phone-field input {
  min-width: 0;
}

textarea {
  min-height: 84px;
  resize: vertical;
}

dialog {
  border: 0;
  border-radius: 10px;
  padding: 0;
  width: min(920px, calc(100vw - 30px));
  box-shadow: 0 24px 80px rgba(15, 36, 74, 0.25);
  max-height: min(86vh, 900px);
  overflow: hidden;
}

.wide-dialog {
  width: min(1160px, calc(100vw - 30px));
}

dialog::backdrop {
  background: rgba(15, 36, 74, 0.3);
}

.dialog-card {
  padding: 20px;
  max-height: min(86vh, 900px);
  overflow-y: auto;
  overflow-x: hidden;
}

.form-note {
  margin: 12px 0 18px;
  color: var(--muted);
}

.form-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
  background: #fbfcfe;
}

.form-section-title {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: baseline;
  margin-bottom: 12px;
}

.form-section-title h3 {
  margin: 0;
  font-size: 16px;
}

.form-section-title span {
  color: var(--muted);
  font-size: 13px;
}

.optional-section {
  background: white;
}

dialog.edit-profile-mode .optional-section details:not(.profile-files-section) {
  display: none;
}

.form-hint {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

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

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

label > span {
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
}

label b {
  color: var(--danger);
  font-size: 14px;
  line-height: 1;
  font-weight: 800;
}

details {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfe;
  margin-top: 10px;
}

summary {
  cursor: pointer;
  font-weight: 700;
}

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

.wide-field {
  grid-column: 1 / -1;
}

.address-panels {
  display: grid;
  gap: 12px;
  margin-top: 2px;
}

.address-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 14px;
}

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

.address-panel-title h4 {
  margin: 0 0 4px;
  color: var(--text);
  font-size: 15px;
}

.address-panel-title p,
.address-panel-title span {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.address-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin: 0;
}

.manual-region-input {
  margin-top: 2px;
}

.inline-check {
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 10px 12px;
  color: var(--text);
}

.inline-check input {
  width: auto;
}

.education-items,
.work-experience-items,
.referee-items {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.education-item,
.work-experience-item,
.referee-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 14px;
}

.education-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.education-expected-completion[hidden],
.education-end-date[hidden],
.work-end-date[hidden] {
  display: none;
}

.add-education-item,
.add-work-experience-item,
.add-referee-item {
  margin-top: 12px;
}

.current-study-note {
  margin: 0;
  border: 1px solid #b7d9c4;
  border-radius: 8px;
  background: #f0fbf5;
  color: #067647;
  padding: 10px 12px;
  line-height: 1.45;
}

@media (max-width: 1050px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 10;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 14px;
  }

  nav {
    display: flex;
    overflow-x: auto;
  }

  .metric-grid,
  #clients-view.active-view,
  .application-layout,
  .client-dashboard-grid,
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .personal-grid,
  .at-a-glance,
  .profile-summary-grid,
  .form-grid {
    grid-template-columns: 1fr 1fr;
  }

  .client-profile-hero {
    grid-template-columns: 96px 1fr;
  }

  .client-hero-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }
}

@media (max-width: 720px) {
  .sidebar {
    flex-wrap: wrap;
  }

  .sidebar nav {
    flex: 1 1 100%;
    width: 100%;
  }

  .auth-shell {
    grid-template-columns: 1fr;
    align-content: start;
    gap: 18px;
    padding: 24px 16px;
  }

  .auth-message {
    grid-column: 1;
  }

  .auth-panel {
    padding: 24px 20px;
  }

  .workspace {
    padding: 16px;
  }

  .topbar,
  .panel-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .table-row {
    grid-template-columns: 1fr;
    gap: 6px;
    padding: 12px 0;
  }

  .table-head {
    display: none;
  }

  .personal-grid,
  .at-a-glance,
  .profile-summary-grid,
  .form-grid,
  .optional-grid {
    grid-template-columns: 1fr;
  }

  .client-profile-hero {
    grid-template-columns: 1fr;
  }

  .client-list-head {
    display: none;
  }

  .client-list-table .client-card {
    grid-template-columns: 1fr;
    gap: 0;
    padding: 14px;
  }

  .client-list-table .client-card > span {
    padding: 10px 0;
    border-top: 1px solid var(--line);
  }

  .client-list-table .client-card > .client-name-cell {
    padding-top: 0;
    border-top: 0;
  }

  .client-list-table .client-card > span:not(.client-name-cell)::before {
    display: block;
    margin-bottom: 5px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
  }

  .client-list-table .client-card > span:nth-child(2)::before { content: "Contact"; }
  .client-list-table .client-card > span:nth-child(3)::before { content: "Current Status"; }
  .client-list-table .client-card > span:nth-child(4)::before { content: "Study Application"; }
  .client-list-table .client-card > span:nth-child(5)::before { content: "Visa Application"; }
  .client-list-table .client-card > span:nth-child(6)::before { content: "Next Attention"; }

  .filter-bar,
  .filter-bar input,
  .filter-bar select {
    width: 100%;
  }
}

.record-dialog {
  width: min(760px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  border: 0;
  padding: 0;
  background: transparent;
}

.record-dialog::backdrop {
  background: rgba(15, 36, 74, 0.42);
}

.record-dialog .dialog-card {
  display: grid;
  gap: 22px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.manage-record-list,
.audit-list {
  display: grid;
  gap: 10px;
}

.manage-record-card,
.audit-list article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}

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

.manage-record-actions {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}

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

.manage-record-grid p,
.audit-list p {
  margin: 0;
}

.audit-list article {
  display: grid;
  gap: 6px;
}

.audit-list span {
  color: var(--muted);
  font-size: 13px;
}

.document-links {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.file-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text);
}

.document-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.document-card p,
.document-card small {
  margin: 5px 0 0;
  color: var(--muted);
}

.record-dialog .auth-message {
  grid-column: 1 / -1;
}

@media (max-width: 720px) {
  .document-card {
    align-items: flex-start;
    flex-direction: column;
  }
}

.profile-editor-page {
  padding: 0;
  overflow: hidden;
}

.profile-editor-page .dialog-card {
  max-height: none;
  overflow: visible;
  border: 0;
  box-shadow: none;
}

.profile-editor-page .dialog-actions {
  position: sticky;
  bottom: 0;
  z-index: 4;
  margin: 18px -20px -20px;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
}

.admin-settings {
  display: grid;
  gap: 18px;
  margin-top: 20px;
}

.settings-admin-section {
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.inline-admin-form {
  display: grid;
  grid-template-columns: 1fr 1.4fr 180px auto;
  gap: 12px;
  align-items: end;
  margin: 16px 0;
}

.inline-admin-form label {
  display: grid;
  gap: 6px;
}

.portable-backup-form {
  grid-template-columns: minmax(260px, 1fr) auto;
}

.temporary-password {
  margin: 12px 0;
  padding: 12px;
  border: 1px solid #e8c36a;
  background: var(--soft-yellow);
  overflow-wrap: anywhere;
}

.backup-reminder {
  margin: 14px 0;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  line-height: 1.45;
}

.backup-reminder.current {
  border-color: #9dd7bd;
  background: var(--soft-green);
  color: #067647;
}

.backup-reminder.due {
  border-color: #e8c36a;
  background: var(--soft-yellow);
  color: #8a5a12;
}

@media (max-width: 900px) {
  .inline-admin-form,
  .portable-backup-form {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1050px) {
  .manage-record-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 720px) {
  .manage-record-grid {
    grid-template-columns: 1fr;
  }

  .records-table .records-row {
    grid-template-columns: 1fr;
  }

  .records-table .records-head {
    display: none;
  }
}
*[hidden] {
  display: none !important;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(220px, 320px) minmax(320px, 520px);
  align-content: center;
  justify-content: center;
  gap: 48px;
  padding: 32px;
  background: #f3f6fa;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  align-self: start;
  padding-top: 22px;
  color: #102d59;
}

.auth-brand strong,
.auth-brand span {
  display: block;
}

.auth-brand strong {
  font-size: 24px;
}

.auth-brand span {
  margin-top: 4px;
  color: #62708a;
}

.auth-panel {
  display: grid;
  gap: 18px;
  padding: 34px;
  border: 1px solid #d7dfeb;
  background: #fff;
  box-shadow: 0 18px 50px rgba(16, 45, 89, 0.12);
}

.auth-panel h1,
.auth-panel p {
  margin: 0;
}

.auth-panel label {
  display: grid;
  gap: 7px;
  color: #52617b;
}

.auth-copy {
  color: #62708a;
  line-height: 1.55;
}

.auth-message {
  grid-column: 2;
  margin: 0;
  padding: 12px 14px;
  border: 1px solid #f0b8b8;
  background: #fff4f4;
  color: #9b1c1c;
}

.mfa-qr {
  width: 220px;
  height: 220px;
  border: 1px solid #d7dfeb;
}

.mfa-secret {
  display: grid;
  gap: 5px;
}

.mfa-secret code {
  overflow-wrap: anywhere;
  color: #102d59;
}

.signed-in-user {
  color: #52617b;
  font-size: 14px;
}
