:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --app-bg: #f4f6f8;
  --app-text: #1f2933;
  --app-border: #d9e2ec;
  --app-muted: #637083;
  --app-surface: #ffffff;
  --app-sidebar: #172033;
  --app-sidebar-soft: #22304a;
  --app-sidebar-text: #e8eef8;
  --app-accent: #2563eb;
  --app-accent-soft: #e8f0ff;
  background: var(--app-bg);
  color: var(--app-text);
}

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

.page {
  padding-top: 32px;
  padding-bottom: 56px;
}

.app-shell {
  min-height: 100vh;
}

.app-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 1030;
  display: none;
  width: 272px;
  padding: 18px;
  background: var(--app-sidebar);
  color: var(--app-sidebar-text);
}

.app-workspace {
  min-width: 0;
  min-height: 100vh;
}

.app-page {
  padding-right: 24px;
  padding-left: 24px;
}

.app-brand {
  display: flex;
  gap: 12px;
  align-items: center;
  min-width: 0;
  color: var(--app-sidebar-text);
  text-decoration: none;
}

.app-brand:hover {
  color: #ffffff;
}

.app-brand-mark {
  display: inline-flex;
  flex: 0 0 42px;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: #ffffff;
  color: #172033;
  font-weight: 800;
}

.app-brand-text {
  overflow: hidden;
  font-weight: 800;
  line-height: 1.2;
  text-overflow: ellipsis;
}

.app-sidebar-section {
  margin-top: 28px;
}

.app-sidebar-label {
  margin-bottom: 8px;
  color: #a9b7cf;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.app-nav {
  display: grid;
  gap: 4px;
}

.app-nav-link {
  display: flex;
  align-items: center;
  min-height: 40px;
  padding: 9px 11px;
  border-radius: 8px;
  color: #cdd8eb;
  font-weight: 700;
  text-decoration: none;
}

.app-nav-link:hover,
.app-nav-link.active {
  background: var(--app-sidebar-soft);
  color: #ffffff;
}

.app-sidebar-footer {
  position: absolute;
  right: 18px;
  bottom: 18px;
  left: 18px;
  display: grid;
  gap: 12px;
}

.app-user-card {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 12px;
  border: 1px solid rgb(255 255 255 / 14%);
  border-radius: 8px;
  background: rgb(255 255 255 / 6%);
}

.app-user-name,
.app-user-id {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-user-name {
  font-weight: 800;
}

.app-user-id {
  color: #a9b7cf;
  font-size: 0.875rem;
}

.app-topbar {
  position: sticky;
  top: 0;
  z-index: 1020;
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--app-border);
  background: rgb(255 255 255 / 94%);
  backdrop-filter: blur(12px);
}

.app-topbar .btn {
  flex: 0 0 auto;
}

.app-topbar-title {
  display: grid;
  min-width: 0;
  margin-right: auto;
}

.app-topbar-title span {
  color: var(--app-muted);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
}

.app-topbar-title strong {
  overflow: hidden;
  max-width: 58vw;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-mobile-nav {
  background: var(--app-sidebar);
  color: var(--app-sidebar-text);
}

.app-mobile-nav .btn-close {
  filter: invert(1) grayscale(100%);
}

.app-mobile-account {
  margin-top: 24px;
}

.panel {
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: 8px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: 0 1px 2px rgb(15 23 42 / 5%);
}

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

h2 {
  font-size: 20px;
  margin: 0 0 16px;
}

.eyebrow {
  margin-bottom: 6px;
  color: var(--app-accent);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.app-navbar {
  background: #ffffff;
  border-bottom: 1px solid var(--app-border);
  box-shadow: 0 1px 2px rgb(15 23 42 / 4%);
}

.navbar-brand {
  min-width: 0;
  overflow: hidden;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-navbar .nav-link {
  border-radius: 6px;
  color: #425466;
  font-weight: 600;
}

.app-navbar .nav-link.active,
.app-navbar .nav-link:hover {
  background: #eef4fb;
  color: #0b5cad;
}

.app-account {
  display: flex;
  gap: 4px;
  align-items: center;
}

.auth-panel {
  max-width: 420px;
  margin-right: auto;
  margin-left: auto;
}

.form-stack {
  display: grid;
  gap: 16px;
}

label {
  font-weight: 600;
}

.form-text,
.hint {
  color: var(--app-muted);
  font-size: 0.875rem;
  font-weight: 400;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.alert ul {
  margin-bottom: 0;
}

.alert-success code,
.notice-code {
  display: inline-block;
  padding: 8px 10px;
  border: 1px solid #9ae6b4;
  border-radius: 6px;
  background: #f0fff4;
  font-size: 1rem;
}

.notice {
  border: 1px solid #9ae6b4;
  border-radius: 6px;
  background: #f0fff4;
  color: #22543d;
  padding: 12px;
  margin: 16px 0;
}

.notice h2 {
  margin-top: 0;
}

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

.app-page-header {
  padding: 0;
}

.page-header p {
  margin-top: 4px;
  margin-bottom: 0;
  color: var(--app-muted);
}

.admin-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

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

.header-actions .btn {
  white-space: normal;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
  align-items: end;
}

fieldset {
  border: 1px solid #d9e2ec;
  border-radius: 6px;
  padding: 10px 12px;
}

legend {
  font-weight: 700;
}

.inline-choice {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-right: 14px;
  font-weight: 500;
}

.inline-choice input {
  width: auto;
}

.table-wrap {
  overflow-x: auto;
}

.table {
  margin-bottom: 0;
}

.table th {
  color: #344054;
  font-size: 0.875rem;
  white-space: nowrap;
}

.table td {
  vertical-align: middle;
}

.table td code {
  word-break: break-all;
}

.tag,
.status-badge {
  margin: 0 4px 4px 0;
  font-weight: 700;
}

.metric-list {
  margin: 0;
  padding-left: 18px;
}

.detail-list {
  display: grid;
  grid-template-columns: minmax(140px, max-content) 1fr;
  gap: 8px 16px;
}

.detail-list dt {
  font-weight: 700;
}

.detail-list dd {
  margin: 0;
  word-break: break-word;
}

.metric-value {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.filter-panel {
  background: #f8fafc;
  border: 1px solid var(--app-border);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 20px;
}

.empty-state {
  margin: 0;
  color: var(--app-muted);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.subtask-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 320px));
}

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

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card,
.mini-card {
  min-width: 0;
  border: 1px solid var(--app-border);
  border-radius: 8px;
  background: var(--app-surface);
  box-shadow: 0 1px 2px rgb(15 23 42 / 5%);
}

.stat-card {
  display: grid;
  gap: 5px;
  padding: 18px;
}

.stat-label,
.stat-note {
  color: var(--app-muted);
  font-size: 0.875rem;
}

.stat-label {
  font-weight: 800;
}

.stat-value {
  color: #101828;
  font-size: 34px;
  line-height: 1.1;
}

.stat-date {
  font-size: 28px;
}

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

.section-header h2 {
  margin-bottom: 4px;
}

.section-header p {
  margin: 0;
  color: var(--app-muted);
}

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

.compact-section-header h2,
.detail-section-header h2 {
  font-size: 18px;
}

.detail-section-header {
  margin-top: 28px;
}

.period-stack {
  display: grid;
  gap: 10px;
}

.period-row {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  padding: 12px;
  border: 1px solid #e6edf5;
  border-radius: 8px;
  background: #fbfdff;
}

.period-row > div {
  min-width: 0;
}

.mini-card {
  display: grid;
  gap: 6px;
  padding: 14px;
}

.mini-card strong {
  font-size: 28px;
  line-height: 1;
}

.dashboard-tile {
  border: 1px solid var(--app-border);
  border-radius: 8px;
  padding: 18px;
  background: #ffffff;
  transition: border-color 120ms ease, box-shadow 120ms ease, transform 120ms ease;
}

a.dashboard-tile {
  color: var(--app-text);
}

a.dashboard-tile:hover {
  border-color: #a7bfef;
  box-shadow: 0 10px 24px rgb(37 99 235 / 10%);
  transform: translateY(-1px);
}

.dashboard-tile h2,
.dashboard-tile h3 {
  margin-bottom: 8px;
  font-size: 18px;
}

.slot-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.slot-row {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  padding: 10px 0;
  border-top: 1px solid #edf2f7;
}

.slot-row > div:first-child {
  min-width: 0;
}

.slot-action {
  flex: 0 0 auto;
}

.small-muted {
  color: var(--app-muted);
  font-size: 0.875rem;
}

@media (max-width: 767.98px) {
  .page {
    padding-top: 20px;
    padding-bottom: 32px;
  }

  .panel {
    padding: 18px;
  }

  .page-header {
    display: grid;
  }

  .header-actions {
    justify-content: flex-start;
  }
}

@media (min-width: 992px) {
  .app-sidebar {
    display: block;
  }

  .app-workspace {
    padding-left: 272px;
  }

  .app-topbar {
    padding-right: 32px;
    padding-left: 32px;
  }

  .app-page {
    padding-right: 32px;
    padding-left: 32px;
  }
}

@media (max-width: 1199.98px) {
  .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workspace-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 575.98px) {
  .app-page {
    padding-right: 16px;
    padding-left: 16px;
  }

  .app-topbar {
    padding-right: 16px;
    padding-left: 16px;
  }

  .stat-grid {
    grid-template-columns: 1fr;
  }

  .section-header {
    display: grid;
  }
}
