:root {
  color-scheme: dark;
  --page: #090a0d;
  --surface: rgba(18, 20, 25, 0.94);
  --surface-raised: rgba(24, 26, 32, 0.96);
  --line: rgba(226, 231, 240, 0.1);
  --line-strong: rgba(238, 49, 56, 0.48);
  --text: #f3f3f4;
  --muted: #a4a8b1;
  --red: #ed343b;
  --red-bright: #ff6268;
  --shadow: 0 24px 64px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  scroll-behavior: smooth;
  scroll-padding-top: 24px;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(ellipse at 82% 4%, rgba(147, 23, 31, 0.16), transparent 34rem),
    radial-gradient(ellipse at 8% 44%, rgba(72, 20, 24, 0.1), transparent 32rem),
    linear-gradient(155deg, #0b0c0f, var(--page) 55%);
  color: var(--text);
  font-family: "Rajdhani", "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
  font-size: 16px;
  letter-spacing: 0.025em;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

body::before {
  position: fixed;
  z-index: -1;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px);
  background-size: 36px 36px;
  content: "";
  pointer-events: none;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

.noise {
  position: fixed;
  z-index: 4;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.045) 0.55px, transparent 0.8px);
  background-size: 7px 7px;
  opacity: 0.12;
  pointer-events: none;
}

.panel-badge,
.eyebrow,
.section-label,
.card-tag {
  font-family: "Orbitron", "Rajdhani", sans-serif;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.17em;
  text-transform: uppercase;
}

.panel-badge,
.eyebrow,
.section-label,
.card-tag {
  color: var(--red-bright);
}

.login-screen {
  position: relative;
  display: grid;
  min-height: 100vh;
  min-height: 100svh;
  overflow: hidden;
  place-items: center;
  padding: 28px;
}

.grid-overlay {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 50% 40%, rgba(237, 52, 59, 0.1), transparent 34rem),
    linear-gradient(90deg, transparent 49.9%, rgba(255, 255, 255, 0.025) 50%, transparent 50.1%);
  pointer-events: none;
}

.lock-panel {
  position: relative;
  width: min(100%, 500px);
  padding: clamp(24px, 5vw, 42px);
  border: 1px solid var(--line-strong);
  background: linear-gradient(145deg, rgba(23, 25, 31, 0.98), rgba(11, 12, 16, 0.98));
  box-shadow: var(--shadow);
}

.lock-panel::before {
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  background: linear-gradient(180deg, var(--red), transparent 88%);
  content: "";
}

.lock-panel h1 {
  margin: 18px 0 8px;
  font-size: clamp(1.45rem, 5vw, 1.9rem);
  font-weight: 600;
  letter-spacing: 0.03em;
}

.lock-panel > p {
  margin: 0;
  color: var(--muted);
  line-height: 1.8;
}

.login-form {
  display: grid;
  gap: 10px;
  margin-top: 26px;
}

.login-form label {
  color: #d3d5da;
  font-size: 0.9rem;
}

.login-form input {
  width: 100%;
  min-height: 50px;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: rgba(5, 6, 8, 0.68);
  color: var(--text);
  font: inherit;
}

.login-form input:focus-visible {
  border-color: var(--red-bright);
  outline: 2px solid rgba(255, 98, 104, 0.35);
  outline-offset: 2px;
}

.login-form button {
  min-height: 50px;
  margin-top: 7px;
  border: 1px solid var(--line-strong);
  background: rgba(237, 52, 59, 0.13);
  color: #ff9a9e;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 160ms ease, border-color 160ms ease;
}

.login-form button:hover,
.login-form button:focus-visible {
  border-color: var(--red-bright);
  background: rgba(237, 52, 59, 0.22);
}

.login-error:not([hidden]) {
  margin-top: 16px;
  color: #ff9296;
}

.portal {
  position: relative;
  z-index: 1;
  width: min(1120px, calc(100% - 48px));
  margin: 28px auto 72px;
}

.topbar {
  position: sticky;
  z-index: 5;
  top: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  background: rgba(12, 13, 16, 0.88);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(18px);
}

.brand-wrap {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  place-items: center;
  border: 1px solid var(--line-strong);
  background: linear-gradient(145deg, rgba(237, 52, 59, 0.2), rgba(237, 52, 59, 0.04));
  color: var(--red-bright);
  font-family: "Orbitron", sans-serif;
  font-size: 1.05rem;
}

.brand-wrap .eyebrow {
  margin-bottom: 2px;
  font-size: 0.58rem;
}

.brand-wrap h2 {
  overflow: hidden;
  margin: 0;
  font-family: "Orbitron", "Rajdhani", sans-serif;
  font-size: 0.94rem;
  font-weight: 600;
  letter-spacing: 0.065em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topnav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.topnav a {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  padding: 0 12px;
  color: var(--muted);
  font-size: 0.86rem;
  text-decoration: none;
  transition: background-color 160ms ease, color 160ms ease;
}

.topnav a:hover,
.topnav a:focus-visible {
  background: rgba(255, 255, 255, 0.055);
  color: var(--text);
}

.topbar form {
  margin: 0;
}

.logout-btn {
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  background: rgba(237, 52, 59, 0.08);
  color: #ff9a9e;
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
  transition: background-color 160ms ease, border-color 160ms ease;
}

.logout-btn:hover,
.logout-btn:focus-visible {
  border-color: var(--red-bright);
  background: rgba(237, 52, 59, 0.17);
}

.panel {
  border: 1px solid var(--line);
  background: linear-gradient(145deg, rgba(23, 25, 31, 0.96), rgba(14, 15, 19, 0.96));
  box-shadow: var(--shadow);
}

.hero {
  position: relative;
  display: grid;
  overflow: hidden;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.78fr);
  align-items: stretch;
  gap: 36px;
  margin-bottom: 20px;
  padding: clamp(28px, 5vw, 56px);
  border-color: rgba(237, 52, 59, 0.27);
}

.hero::after {
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  background: linear-gradient(180deg, var(--red), transparent 88%);
  content: "";
}

.hero-copy {
  align-self: center;
}

.hero-copy .eyebrow {
  font-size: 0.66rem;
}

.hero-copy h1 {
  margin: 16px 0;
  font-family: "Orbitron", "Rajdhani", sans-serif;
  font-size: clamp(2.1rem, 5.2vw, 4.4rem);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: 0.055em;
  overflow-wrap: anywhere;
}

.hero-copy p {
  max-width: 56ch;
  margin: 0;
  color: #c1c3c9;
  font-size: 1.04rem;
  line-height: 1.85;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 24px;
}

.chip {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  padding: 5px 11px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.025);
  color: #d3d5da;
  font-size: 0.78rem;
}

.chip.accent {
  border-color: var(--line-strong);
  background: rgba(237, 52, 59, 0.07);
  color: #ff9296;
}

.hero-panel {
  display: grid;
  min-height: 250px;
  align-content: center;
  padding: 20px;
  border: 1px solid rgba(237, 52, 59, 0.22);
  background:
    radial-gradient(ellipse at 50% 0, rgba(237, 52, 59, 0.14), transparent 70%),
    rgba(5, 6, 8, 0.42);
}

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

.mini-grid div {
  display: flex;
  min-height: 86px;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  padding: 13px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.025);
}

.mini-grid span {
  color: var(--muted);
  font-size: 0.78rem;
}

.mini-grid strong {
  color: var(--red-bright);
  font-family: "Orbitron", "Rajdhani", sans-serif;
  font-size: clamp(1.05rem, 2vw, 1.45rem);
  font-weight: 600;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.overview-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.stat-card {
  min-width: 0;
  padding: 21px 22px;
}

.stat-card h3 {
  margin: 9px 0 8px;
  font-size: 1.18rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.stat-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.96rem;
  line-height: 1.75;
}

.calendar-panel {
  margin-bottom: 20px;
  padding: clamp(20px, 3.2vw, 30px);
}

.calendar-toolbar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  margin: 18px 0 8px;
}

.calendar-month-navigation {
  display: flex;
  gap: 6px;
}

.calendar-month-navigation button {
  min-width: 42px;
}

.calendar-toolbar h4 {
  margin: 0;
  color: var(--text);
  font-size: 1.18rem;
  font-weight: 600;
  text-align: center;
}

.calendar-status {
  min-height: 1.6em;
  margin: 8px 2px 12px;
  color: var(--muted);
  font-size: 0.9rem;
}

.calendar-status.error {
  color: #ff9296;
}

.calendar-weekdays,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.calendar-weekdays {
  border: 1px solid var(--line);
  border-bottom: 0;
  background: rgba(237, 52, 59, 0.06);
}

.calendar-weekdays span {
  padding: 8px 4px;
  color: var(--muted);
  font-size: 0.78rem;
  text-align: center;
}

.calendar-weekdays span:first-child {
  color: #ff9296;
}

.calendar-grid {
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.calendar-day {
  min-width: 0;
  min-height: 112px;
  padding: 7px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.018);
}

.calendar-day.outside-month {
  background: rgba(0, 0, 0, 0.16);
}

.calendar-day.outside-month .calendar-day-number {
  color: #666b75;
}

.calendar-day.today {
  background: rgba(237, 52, 59, 0.075);
  box-shadow: inset 0 0 0 1px rgba(237, 52, 59, 0.38);
}

.calendar-day-number {
  display: grid;
  width: 25px;
  height: 25px;
  place-items: center;
  border-radius: 50%;
  color: #d3d5da;
  font-size: 0.82rem;
}

.calendar-day.today .calendar-day-number {
  background: var(--red);
  color: #fff;
}

.calendar-day-events {
  display: grid;
  gap: 3px;
  margin-top: 4px;
}

.calendar-event {
  display: grid;
  min-width: 0;
  gap: 1px;
  padding: 3px 5px;
  border-left: 2px solid var(--red-bright);
  background: rgba(237, 52, 59, 0.1);
  color: #f0d7d8;
  font-size: 0.72rem;
  line-height: 1.35;
}

.calendar-event.all-day {
  border-left-color: #ff9296;
  background: rgba(237, 52, 59, 0.17);
}

.calendar-event-time {
  color: #ff9296;
  font-size: 0.65rem;
}

.calendar-event-title {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow-wrap: anywhere;
}

.file-browser,
.journal {
  margin-bottom: 20px;
  padding: clamp(20px, 3.2vw, 30px);
}

.file-browser .section-header {
  margin-bottom: 8px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.section-header h3 {
  margin: 4px 0 0;
  font-size: 1.32rem;
  font-weight: 600;
  letter-spacing: 0.025em;
}

.file-browser-intro {
  margin: 0;
  color: var(--muted);
  line-height: 1.75;
}

.file-browser-intro code {
  padding: 2px 6px;
  border: 1px solid var(--line-strong);
  background: rgba(237, 52, 59, 0.08);
  color: #ff9296;
}

.file-toolbar {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
  margin: 18px 0 8px;
  padding: 9px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.025);
}

.file-toolbar-button {
  min-height: 42px;
  flex: 0 0 auto;
  padding: 0 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.035);
  font: inherit;
  cursor: pointer;
}

.file-toolbar-button:hover:not(:disabled),
.file-toolbar-button:focus-visible:not(:disabled) {
  border-color: var(--line-strong);
  color: #ff9296;
}

.file-toolbar-button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.file-breadcrumb {
  display: flex;
  min-width: 0;
  flex: 1;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  color: var(--muted);
  white-space: nowrap;
  scrollbar-width: thin;
}

.file-breadcrumb button {
  min-height: 38px;
  padding: 0 4px;
  border: 0;
  background: transparent;
  color: #ff9296;
  font: inherit;
  cursor: pointer;
}

.file-breadcrumb button:hover {
  text-decoration: underline;
}

.file-status {
  min-height: 1.6em;
  margin: 9px 2px;
  color: var(--muted);
  font-size: 0.9rem;
}

.file-status.error {
  color: #ff9296;
}

.file-list {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--line);
}

.file-entry {
  display: flex;
  width: 100%;
  min-height: 64px;
  align-items: center;
  gap: 13px;
  padding: 10px 12px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.018);
  color: var(--text);
  text-align: left;
  text-decoration: none;
  transition: background-color 150ms ease;
}

.file-entry-button {
  font: inherit;
  cursor: pointer;
}

.file-entry-button:hover,
.file-entry-link:hover {
  background: rgba(237, 52, 59, 0.07);
}

.file-entry-icon {
  display: grid;
  width: 44px;
  height: 38px;
  flex: 0 0 44px;
  place-items: center;
  border: 1px solid var(--line);
  color: var(--red-bright);
  font-family: "Orbitron", sans-serif;
  font-size: 0.61rem;
  letter-spacing: 0.06em;
}

.file-entry-icon.folder {
  border-color: var(--line-strong);
  background: rgba(237, 52, 59, 0.06);
}

.file-entry-name {
  min-width: 0;
  overflow-wrap: anywhere;
}

.file-entry-meta {
  margin-left: auto;
  color: var(--muted);
  font-size: 0.84rem;
  white-space: nowrap;
}

.pdf-viewer {
  width: min(1180px, calc(100vw - 32px));
  height: min(1000px, calc(100dvh - 40px));
  max-width: none;
  max-height: none;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  background: var(--page);
  color: var(--text);
  box-shadow: var(--shadow);
}

.pdf-viewer[open] {
  display: flex;
  flex-direction: column;
}

.pdf-viewer::backdrop {
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(5px);
}

.pdf-viewer-header {
  display: grid;
  flex: 0 0 auto;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  padding: 8px 12px 8px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.pdf-viewer-header h3 {
  grid-column: 1;
  grid-row: 1;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  font-size: 1rem;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pdf-viewer-controls {
  display: flex;
  grid-column: 1 / 3;
  grid-row: 2;
  align-items: center;
  gap: 6px;
}

.pdf-viewer-controls .file-toolbar-button {
  min-height: 38px;
  padding: 0 10px;
  font-size: 0.84rem;
}

.pdf-viewer-controls .file-toolbar-button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.pdf-zoom-level {
  min-width: 48px;
  color: var(--muted);
  font-size: 0.82rem;
  text-align: center;
}

.pdf-page-count {
  grid-column: 2;
  grid-row: 1;
  color: var(--muted);
  font-size: 0.8rem;
  white-space: nowrap;
}

#pdf-viewer-close {
  grid-column: 3;
  grid-row: 1;
}

.pdf-viewer-status {
  flex: 0 0 auto;
  min-height: 28px;
  margin: 0;
  padding: 4px 12px;
  background: rgba(0, 0, 0, 0.28);
  color: var(--muted);
  font-size: 0.8rem;
  text-align: center;
}

.pdf-viewer-pages {
  display: flex;
  width: 100%;
  min-height: 0;
  flex: 1;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 18px;
  background: #27292e;
}

.pdf-page {
  position: relative;
  display: flex;
  max-width: 100%;
  flex: 0 0 auto;
  align-items: flex-start;
  justify-content: center;
  background: #fff;
  box-shadow: 0 5px 22px rgba(0, 0, 0, 0.38);
}

.pdf-page-canvas {
  display: block;
  max-width: none;
  background: #fff;
}

.pdf-page-label {
  position: absolute;
  z-index: 1;
  right: 8px;
  bottom: 8px;
  padding: 3px 7px;
  background: rgba(9, 10, 13, 0.74);
  color: #fff;
  font-size: 0.7rem;
  pointer-events: none;
}

.personal-card {
  margin-bottom: 32px;
}

.personal-details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin: 0;
  border: 1px solid var(--line);
  background: var(--line);
}

.personal-detail {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(145px, 0.85fr) minmax(0, 1.3fr);
  align-items: start;
  gap: 12px;
  padding: 14px 16px;
  background: var(--surface);
}

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

.personal-detail dt {
  color: var(--muted);
  font-size: 0.9rem;
}

.personal-detail dd {
  min-width: 0;
  margin: 0;
  color: var(--text);
  font-size: 0.98rem;
  font-weight: 500;
  overflow-wrap: anywhere;
  word-break: normal;
}

.personal-detail:last-child dd {
  font-family: "Rajdhani", sans-serif;
  font-size: 1.08rem;
  letter-spacing: 0.12em;
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--red-bright);
  outline-offset: 3px;
}

@media (max-width: 900px) {
  .topbar {
    flex-wrap: wrap;
  }

  .topnav {
    order: 3;
    width: 100%;
    justify-content: flex-start;
    border-top: 1px solid var(--line);
    padding-top: 8px;
  }

  .hero {
    grid-template-columns: minmax(0, 1.15fr) minmax(230px, 0.85fr);
    gap: 22px;
  }

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

  .stat-card:last-child {
    grid-column: 1 / -1;
  }
}

@media (max-width: 640px) {
  html {
    scroll-padding-top: 12px;
  }

  .login-screen {
    padding: 18px;
  }

  .lock-panel {
    padding: 25px 20px;
  }

  .panel-badge {
    font-size: 0.6rem;
    letter-spacing: 0.12em;
  }

  body {
    font-size: 15px;
    letter-spacing: 0.01em;
  }

  .portal {
    width: calc(100% - 28px);
    margin: 14px auto 40px;
  }

  .topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    position: relative;
    top: auto;
    gap: 8px 12px;
    margin-bottom: 14px;
    padding: 12px;
  }

  .brand-wrap {
    flex: 1 1 210px;
    gap: 10px;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
    flex-basis: 38px;
  }

  .brand-wrap .eyebrow {
    font-size: 0.52rem;
    letter-spacing: 0.1em;
  }

  .brand-wrap h2 {
    font-size: 0.84rem;
    letter-spacing: 0.025em;
  }

  .logout-btn {
    min-height: 42px;
    padding: 0 10px;
  }

  .topnav {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-content: flex-start;
    gap: 2px;
    overflow-x: auto;
    padding-top: 8px;
    scrollbar-width: thin;
    white-space: nowrap;
  }

  .topbar form {
    grid-column: 2;
    grid-row: 1;
  }

  .topnav a {
    flex: 0 0 auto;
    min-height: 42px;
    padding: 0 8px;
    font-size: 0.82rem;
  }

  .hero {
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
    margin-bottom: 14px;
    padding: 25px 20px 20px;
  }

  .hero-copy .eyebrow {
    font-size: 0.59rem;
    letter-spacing: 0.1em;
  }

  .hero-copy h1 {
    margin: 12px 0;
    font-size: clamp(1.7rem, 8vw, 2.6rem);
    line-height: 1.13;
    letter-spacing: 0.01em;
    overflow-wrap: normal;
    word-break: keep-all;
  }

  .hero-copy p {
    font-size: 0.98rem;
    line-height: 1.75;
  }

  .hero-actions {
    gap: 7px;
    margin-top: 17px;
  }

  .hero-panel {
    min-height: 0;
    padding: 12px;
  }

  .mini-grid {
    gap: 8px;
  }

  .mini-grid div {
    min-height: 74px;
    padding: 10px;
  }

  .mini-grid span {
    font-size: 0.74rem;
  }

  .mini-grid strong {
    font-size: clamp(0.9rem, 4.2vw, 1.2rem);
  }

  .overview-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    margin-bottom: 14px;
  }

  .stat-card,
  .stat-card:last-child {
    grid-column: auto;
    padding: 17px 18px;
  }

  .stat-card h3 {
    font-size: 1.12rem;
  }

  .file-browser,
  .journal,
  .calendar-panel {
    margin-bottom: 14px;
    padding: 18px 15px;
  }

  .pdf-viewer {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    margin: auto;
    border: 0;
  }

  .pdf-viewer-header {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px 8px;
    padding: 8px 10px;
  }

  .pdf-viewer-header h3 {
    font-size: 0.92rem;
  }

  .pdf-page-count {
    grid-column: 2;
    grid-row: 1;
  }

  #pdf-viewer-close {
    grid-column: 2;
    grid-row: 2;
    justify-self: end;
  }

  .pdf-viewer-controls {
    grid-column: 1;
    grid-row: 2;
    flex-wrap: wrap;
    gap: 4px;
  }

  .pdf-viewer-controls .file-toolbar-button {
    min-height: 40px;
    padding: 0 8px;
    font-size: 0.75rem;
  }

  .pdf-zoom-level {
    min-width: 40px;
    font-size: 0.74rem;
  }

  .pdf-viewer-pages {
    align-items: flex-start;
    padding: 12px;
  }

  .pdf-page {
    max-width: none;
    align-self: center;
  }

  .calendar-toolbar {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    margin-top: 14px;
  }

  .calendar-toolbar h4 {
    grid-column: 1;
    grid-row: 2;
    text-align: left;
  }

  .calendar-month-navigation {
    grid-column: 1;
    grid-row: 1;
  }

  #calendar-refresh {
    grid-column: 2;
    grid-row: 1;
  }

  .calendar-day {
    min-height: 78px;
    padding: 4px 3px;
  }

  .calendar-day-number {
    width: 22px;
    height: 22px;
    font-size: 0.75rem;
  }

  .calendar-day-events {
    gap: 2px;
    margin-top: 3px;
  }

  .calendar-event {
    gap: 0;
    padding: 2px 3px;
    font-size: 0.62rem;
    line-height: 1.25;
  }

  .calendar-event-time {
    font-size: 0.56rem;
  }

  .section-header {
    align-items: flex-start;
    gap: 10px;
    padding-bottom: 11px;
  }

  .section-header h3 {
    font-size: 1.15rem;
  }

  .section-label {
    font-size: 0.59rem;
    letter-spacing: 0.12em;
  }

  .file-browser .chip {
    min-height: 30px;
    padding: 4px 8px;
    font-size: 0.72rem;
  }

  .file-browser-intro {
    font-size: 0.92rem;
  }

  .file-toolbar {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 6px;
    padding: 7px;
  }

  .file-toolbar-button {
    min-height: 42px;
    padding: 0 9px;
    font-size: 0.84rem;
  }

  .file-breadcrumb {
    order: 3;
    grid-column: 1 / -1;
    width: 100%;
    padding: 2px 3px;
  }

  .file-entry {
    min-height: 58px;
    gap: 10px;
    padding: 9px 5px;
  }

  .file-entry-icon {
    width: 40px;
    height: 36px;
    flex-basis: 40px;
  }

  .file-entry-name {
    font-size: 0.92rem;
  }

  .file-entry-meta {
    font-size: 0.76rem;
  }

  .personal-card {
    margin-bottom: 20px;
  }

  .personal-details {
    grid-template-columns: minmax(0, 1fr);
  }

  .personal-detail,
  .personal-detail-wide {
    grid-column: auto;
    grid-template-columns: minmax(110px, 0.75fr) minmax(0, 1.25fr);
    gap: 8px;
    padding: 12px;
  }

  .personal-detail dt {
    font-size: 0.82rem;
  }

  .personal-detail dd {
    font-size: 0.92rem;
  }
}

@media (max-width: 360px) {
  .portal {
    width: calc(100% - 20px);
  }

  .topnav a {
    padding: 0 5px;
    font-size: 0.76rem;
  }

  .personal-detail,
  .personal-detail-wide {
    grid-template-columns: minmax(95px, 0.72fr) minmax(0, 1.28fr);
    gap: 6px;
    padding: 10px;
  }
}

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