:root {
  color-scheme: light;
  --bg: #f4f7f8;
  --panel: #ffffff;
  --ink: #15202b;
  --muted: #64727f;
  --line: #dbe4e8;
  --soft: #eef4f5;
  --primary: #0f766e;
  --primary-strong: #115e59;
  --accent: #2563eb;
  --deep-blue: #071f3d;
  --deep-blue-line: #123d6b;
  --warn: #b45309;
  --danger: #b42318;
  --hold: #6d5bd0;
  --shadow: 0 16px 38px rgba(18, 38, 48, 0.10);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, #edf5f4 0, #f7f9fb 280px),
    var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans", "Yu Gothic UI", sans-serif;
}

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

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.has-session body.booting .auth-shell {
  display: none;
}

.has-session body.booting {
  background: var(--bg);
}

.auth-shell {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
  background:
    linear-gradient(180deg, rgba(18, 52, 59, 0.92), rgba(18, 52, 59, 0.82)),
    linear-gradient(135deg, #e6f3f1, #f8fafc);
}

.auth-panel {
  width: min(100%, 460px);
  border: 1px solid rgba(255, 255, 255, 0.52);
  border-radius: 8px;
  padding: 24px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 22px 60px rgba(11, 34, 40, 0.24);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}

.auth-brand .eyebrow {
  color: var(--muted);
}

.auth-brand h1 {
  color: var(--ink);
}

.auth-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 18px;
  padding: 5px;
  border-radius: 8px;
  background: var(--soft);
}

.auth-tab {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-weight: 850;
}

.auth-tab.active {
  background: #ffffff;
  color: var(--primary-strong);
  box-shadow: 0 8px 22px rgba(18, 38, 48, 0.10);
}

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

.auth-form.active {
  display: grid;
}

.auth-submit {
  width: 100%;
  margin-top: 2px;
}

.auth-note {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  grid-template-rows: 68px 1fr auto;
  min-height: 100vh;
  background:
    linear-gradient(90deg, #12343b 0 260px, transparent 260px),
    var(--bg);
}

.global-header {
  position: sticky;
  top: 0;
  z-index: 20;
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 68px;
  padding: 0 clamp(16px, 3vw, 34px);
  border-bottom: 1px solid var(--deep-blue-line);
  background: var(--deep-blue);
  backdrop-filter: blur(14px);
  box-shadow: 0 10px 28px rgba(7, 31, 61, 0.22);
}

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

.company-logo {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: var(--deep-blue);
  color: #17333b;
  font-weight: 850;
  font-size: 22px;
}

.logo-mark {
  overflow: hidden;
  background: transparent;
}

.logo-mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.company-name,
.app-name {
  margin: 0;
  line-height: 1.25;
}

.company-name {
  color: rgba(255, 255, 255, 0.74);
  font-size: 13px;
  font-weight: 800;
}

.app-name {
  color: #ffffff;
  font-size: 18px;
  font-weight: 850;
}

.menu-button {
  display: grid;
  place-items: center;
  gap: 4px;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
}

.menu-button span {
  display: block;
  width: 20px;
  height: 2px;
  border-radius: 999px;
  background: #ffffff;
}

.menu-button:hover {
  background: rgba(255, 255, 255, 0.16);
}

.sidebar {
  grid-column: 1;
  grid-row: 2;
  display: flex;
  flex-direction: column;
  gap: 22px;
  min-height: calc(100vh - 68px - 52px);
  max-height: calc(100vh - 68px);
  overflow-y: auto;
  padding: 24px 18px;
  background: #12343b;
  color: #f8fbff;
  transition: transform 180ms ease, opacity 180ms ease;
}

.sidebar > .brand {
  display: none;
}

body.nav-closed .sidebar {
  transform: translateX(-100%);
  opacity: 0;
  pointer-events: none;
}

body.nav-closed .main {
  grid-column: 1 / -1;
}

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

.brand-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 8px;
  background: #ffffff;
  color: #17333b;
  font-weight: 850;
  font-size: 24px;
}

.eyebrow {
  margin: 0 0 5px;
  color: inherit;
  opacity: 0.68;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
}

h1,
h2,
h3,
h4,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 21px;
  line-height: 1.25;
}

h2 {
  margin-bottom: 7px;
  font-size: 30px;
  line-height: 1.2;
}

h3 {
  margin-bottom: 0;
  font-size: 21px;
}

.view-lead {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

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

.nav-button {
  min-height: 46px;
  border: 0;
  border-radius: 8px;
  padding: 0 14px;
  background: transparent;
  color: #d8edf0;
  text-align: left;
  font-weight: 750;
}

.nav-button:hover,
.nav-button.active {
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
}

.nav-button.active {
  box-shadow: inset 4px 0 0 #f8d66d;
}

.user-panel {
  margin-top: auto;
  flex: 0 0 auto;
  padding: 15px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
}

.user-panel label {
  display: block;
  margin-bottom: 8px;
  color: #d8edf0;
  font-size: 13px;
  font-weight: 750;
}

.user-panel select {
  width: 100%;
}

.user-panel p {
  margin: 10px 0 0;
  color: #d8edf0;
  font-size: 13px;
  line-height: 1.45;
}

.logout-button {
  width: 100%;
  min-height: 38px;
  margin-top: 14px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  font-weight: 800;
}

.logout-button:hover {
  background: rgba(255, 255, 255, 0.15);
}

.main {
  grid-column: 2;
  grid-row: 2;
  min-width: 0;
  min-height: calc(100vh - 68px - 52px);
  padding: 30px clamp(20px, 4vw, 48px) 44px;
  background: var(--bg);
}

.app-footer {
  grid-column: 1 / -1;
  grid-row: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  min-height: 52px;
  padding: 12px 18px;
  border-top: 1px solid var(--deep-blue-line);
  background: var(--deep-blue);
  color: rgba(255, 255, 255, 0.76);
  font-size: 13px;
  font-weight: 700;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(330px, 430px);
  align-items: end;
  gap: 24px;
  margin-bottom: 26px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 0 0 18px;
}

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

.stat-card {
  min-height: 78px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 8px 24px rgba(18, 38, 48, 0.06);
}

.stat-card span {
  display: block;
  margin-bottom: 4px;
  color: var(--ink);
  font-size: 28px;
  font-weight: 850;
  line-height: 1;
}

.stat-card small {
  color: var(--muted);
  font-weight: 700;
}

.pending-stat {
  border-top: 4px solid #f59e0b;
}

.approved-stat {
  border-top: 4px solid var(--primary);
}

.notice-stat {
  border-top: 4px solid var(--accent);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.panel,
.request-card,
.notice-card,
.analytics-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 18px;
  padding: 22px;
}

.form-section-title {
  margin: 2px 0 -4px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  color: var(--primary-strong);
  font-size: 14px;
  font-weight: 850;
}

.form-section-title:first-child {
  padding-top: 0;
  border-top: 0;
}

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

.field label {
  color: #2d3b45;
  font-size: 13px;
  font-weight: 800;
}

.span-2 {
  grid-column: span 2;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid #c7d4da;
  border-radius: 8px;
  padding: 10px 12px;
  background: #ffffff;
  color: var(--ink);
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  outline: 3px solid rgba(15, 118, 110, 0.16);
}

.actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 2px;
}

.primary,
.secondary,
.danger,
.hold {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  padding: 0 17px;
  font-weight: 800;
}

.primary {
  background: var(--primary);
  color: #ffffff;
}

.primary:hover {
  background: var(--primary-strong);
}

.secondary {
  border: 1px solid var(--line);
  background: #ffffff;
  color: #2d3b45;
}

.secondary:hover {
  background: var(--soft);
}

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

.hold {
  background: #f0efff;
  color: var(--hold);
}

.list {
  display: grid;
  gap: 14px;
}

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

.home-card {
  display: grid;
  gap: 8px;
  min-height: 150px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: #ffffff;
  color: var(--ink);
  text-align: left;
  box-shadow: 0 12px 28px rgba(18, 38, 48, 0.07);
}

.home-card:hover {
  border-color: rgba(15, 118, 110, 0.42);
  transform: translateY(-1px);
}

.home-card span {
  width: fit-content;
  border-radius: 999px;
  padding: 4px 10px;
  background: var(--soft);
  color: var(--primary-strong);
  font-size: 12px;
  font-weight: 850;
}

.home-card strong {
  font-size: 19px;
  line-height: 1.35;
}

.home-card small {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.primary-home-card {
  border-color: rgba(15, 118, 110, 0.34);
  background: #f0faf8;
}

.quick-apply {
  padding: 18px;
}

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

.request-type-button {
  display: grid;
  gap: 6px;
  min-height: 86px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px;
  background: #ffffff;
  color: var(--ink);
  text-align: left;
}

.request-type-button:hover {
  border-color: var(--primary);
  background: #f6fffd;
}

.request-type-button strong {
  font-size: 15px;
}

.request-type-button span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.empty {
  padding: 28px;
  border: 1px dashed #b8c8cf;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.62);
  color: var(--muted);
  text-align: center;
}

.request-card,
.notice-card {
  padding: 18px;
}

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.request-card h4,
.notice-card h4 {
  margin: 0 0 8px;
  font-size: 18px;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 13px;
}

.meta span {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  background: var(--soft);
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  white-space: nowrap;
  border-radius: 999px;
  padding: 0 11px;
  background: #e2e8f0;
  color: #334155;
  font-size: 12px;
  font-weight: 850;
}

.badge.pending {
  background: #fff7ed;
  color: var(--warn);
}

.badge.approved {
  background: #ecfdf3;
  color: var(--primary-strong);
}

.badge.rejected {
  background: #fff1f0;
  color: var(--danger);
}

.badge.hold {
  background: #f0efff;
  color: var(--hold);
}

.card-body {
  display: grid;
  gap: 10px;
  color: #334155;
  line-height: 1.6;
}

.review-box {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

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

.notice-card.unread {
  border-left: 5px solid var(--accent);
}

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

.leave-summary {
  display: grid;
  gap: 16px;
}

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

.primary-metric {
  border-top: 4px solid var(--primary);
}

.leave-rule-panel {
  display: grid;
  gap: 8px;
}

.leave-rule-panel h3,
.leave-rule-panel p {
  margin: 0;
}

.leave-rule-panel p {
  color: var(--muted);
  line-height: 1.7;
}

.settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  gap: 16px;
}

.accounts-grid {
  display: grid;
  grid-template-columns: minmax(320px, 0.85fr) minmax(0, 1.15fr);
  gap: 16px;
  align-items: start;
}

.csv-panel {
  display: grid;
  gap: 14px;
}

.csv-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.file-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #ffffff;
  font-weight: 700;
  cursor: pointer;
}

.csv-status {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.account-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 8px 24px rgba(18, 38, 48, 0.05);
}

.account-card h4 {
  margin: 0 0 8px;
}

.account-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
}

.settings-panel {
  padding: 20px;
}

.settings-user dl {
  display: grid;
  gap: 10px;
  margin: 14px 0 0;
}

.settings-user div {
  display: grid;
  grid-template-columns: 100px minmax(0, 1fr);
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.settings-user dt,
.settings-user dd {
  margin: 0;
}

.settings-user dt {
  color: var(--muted);
  font-weight: 800;
}

.settings-user dd {
  color: var(--ink);
  font-weight: 750;
}

.settings-note {
  color: var(--muted);
  line-height: 1.6;
}

.analytics-section {
  padding: 18px;
}

.analytics-section.plain-section {
  border: 0;
  padding: 0;
  background: transparent;
  box-shadow: none;
}

.analytics-section h4,
.metric-card h4 {
  margin: 0 0 12px;
  font-size: 16px;
}

.span-full {
  grid-column: 1 / -1;
}

.metric-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: var(--panel);
  box-shadow: 0 10px 26px rgba(18, 38, 48, 0.07);
}

.metric-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.metric-head span {
  border-radius: 999px;
  padding: 4px 9px;
  background: #ecfdf3;
  color: var(--primary-strong);
  font-size: 12px;
  font-weight: 850;
}

.metric-main {
  margin: 0;
  color: var(--primary);
  font-size: 38px;
  font-weight: 850;
  line-height: 1;
}

.metric-main span {
  margin-left: 5px;
  color: var(--muted);
  font-size: 14px;
}

.metric-breakdown {
  display: grid;
  gap: 8px;
  margin: 14px 0 0;
}

.metric-breakdown div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

.metric-breakdown dt,
.metric-breakdown dd {
  margin: 0;
}

.metric-breakdown dd {
  color: #2d3b45;
  font-weight: 800;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 11px 8px;
  text-align: left;
}

th {
  color: #2d3b45;
}

td {
  color: #334155;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  max-width: 360px;
  transform: translateY(120%);
  transition: transform 180ms ease;
  border-radius: 8px;
  padding: 14px 16px;
  background: #17212b;
  color: #ffffff;
  box-shadow: var(--shadow);
}

.toast.show {
  transform: translateY(0);
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: 68px auto 1fr auto;
    background: var(--bg);
  }

  .sidebar {
    position: static;
    grid-column: 1;
    grid-row: 2;
    height: auto;
    min-height: 0;
    max-height: none;
    padding: 18px;
  }

  body.nav-closed .sidebar {
    display: none;
  }

  body.nav-closed .main,
  .main {
    grid-column: 1;
  }

  .main {
    grid-row: 3;
  }

  .app-footer {
    grid-row: 4;
  }

  body.nav-closed .main {
    grid-row: 2;
  }

  body.nav-closed .app-footer {
    grid-row: 3;
  }

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

  .user-panel {
    margin-top: 0;
  }

  .main {
    padding: 20px 18px 34px;
  }

  .topbar {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

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

@media (max-width: 720px) {
  .section-head,
  .card-top {
    align-items: stretch;
    flex-direction: column;
  }

  .stats,
  .metric-grid,
  .analytics-grid,
  .leave-grid,
  .home-grid,
  .request-type-grid,
  .accounts-grid,
  .settings-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

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

  .actions {
    flex-direction: column-reverse;
  }

  .actions button,
  .account-actions button,
  .review-actions button {
    width: 100%;
  }

  .account-card,
  .account-actions {
    align-items: stretch;
    flex-direction: column;
  }
}
