:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-strong: #eef3f7;
  --ink: #15202b;
  --muted: #657284;
  --line: #dce3eb;
  --primary: #0f766e;
  --primary-dark: #0b5f59;
  --primary-soft: #d8f3ef;
  --danger: #b42318;
  --danger-soft: #fde7e5;
  --warning: #a15c07;
  --warning-soft: #fff2d6;
  --success: #12703b;
  --success-soft: #e1f7e8;
  --info: #2356a7;
  --info-soft: #e5eefc;
  --shadow: 0 18px 45px rgba(36, 48, 70, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
}

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

button {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(180deg, rgba(16, 24, 32, 0.03), rgba(16, 24, 32, 0.08)),
    var(--bg);
}

.login-card {
  width: min(440px, 100%);
  display: grid;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.login-brand {
  margin-bottom: 6px;
  color: var(--ink);
  align-items: center;
}

.login-brand span {
  color: var(--muted);
}

.login-brand .brand-logo {
  width: 150px;
}

.form-error {
  min-height: 20px;
  margin: 0;
  color: var(--danger);
  font-size: 14px;
  font-weight: 750;
}

.login-help {
  display: grid;
  gap: 5px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.login-help strong {
  color: var(--ink);
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 24px;
  background: #101820;
  color: #f9fbfc;
}

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

.brand-logo {
  display: block;
  width: 120px;
  max-width: 44vw;
  height: auto;
  object-fit: contain;
}

.sidebar-logo {
  width: 96px;
  padding: 5px;
  border-radius: 8px;
  background: #ffffff;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: #2dd4bf;
  color: #073b36;
  font-weight: 800;
}

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

.brand span {
  margin-top: 2px;
  color: #b8c4cf;
  font-size: 13px;
}

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

.nav-item,
.mobile-item {
  border: 0;
  background: transparent;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px;
  border-radius: 8px;
  color: #cdd6df;
  text-align: left;
}

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

.icon {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  color: #2dd4bf;
}

.sidebar-card {
  margin-top: auto;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.sidebar-card span {
  display: block;
  margin-bottom: 8px;
  color: #b8c4cf;
  font-size: 13px;
}

.sidebar-card strong,
.sidebar-card small {
  display: block;
}

.sidebar-card strong {
  margin-bottom: 4px;
  color: #ffffff;
}

.sidebar-card small {
  margin-bottom: 12px;
  color: #b8c4cf;
  line-height: 1.35;
}

.sidebar-card hr {
  border: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  margin: 12px 0;
}

.sidebar-card select {
  width: 100%;
  min-height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  background: #17212b;
  color: #ffffff;
  padding: 0 10px;
}

.signout-button {
  width: 100%;
  margin-top: 12px;
  background: transparent;
  color: #ffffff;
}

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

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

.topbar {
  margin-bottom: 28px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.05;
}

h2 {
  margin-bottom: 6px;
  font-size: 24px;
}

h3 {
  margin-bottom: 4px;
  font-size: 17px;
}

p {
  color: var(--muted);
}

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

.primary-button,
.ghost-button,
.danger-button,
.kiv-button,
.reminder-button,
.icon-button {
  min-height: 42px;
  border-radius: 8px;
  padding: 0 14px;
  font-weight: 750;
}

.primary-button {
  border: 1px solid var(--primary);
  background: var(--primary);
  color: #ffffff;
}

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

.ghost-button {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}

.danger-button {
  border: 1px solid var(--danger);
  background: var(--danger);
  color: #ffffff;
}

.kiv-button {
  border: 1px solid #d59632;
  background: #fff8e9;
  color: var(--warning);
}

.reminder-button {
  border: 1px solid #2563eb;
  background: #eaf1ff;
  color: #1d4ed8;
}

.reminder-button:hover {
  background: #dbe8ff;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 40px;
  padding: 0;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-size: 26px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.section-heading {
  margin-bottom: 18px;
}

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

.metric-card,
.panel,
.form-panel,
.approval-card,
.stage-column,
.user-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.metric-card {
  padding: 16px;
}

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

.metric-card strong {
  display: block;
  margin-top: 8px;
  font-size: 32px;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(360px, 0.75fr);
  gap: 18px;
}

.kpi-layout,
.admin-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(360px, 0.6fr);
  gap: 18px;
  align-items: start;
}

.admin-layout {
  grid-template-columns: minmax(360px, 0.75fr) minmax(0, 1.25fr);
}

.status-update-layout {
  display: grid;
  grid-template-columns: minmax(360px, 0.85fr) minmax(0, 1.15fr);
  gap: 18px;
  align-items: start;
  margin-bottom: 18px;
}

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

.panel {
  min-width: 0;
  padding: 18px;
}

.wide-panel {
  min-height: 560px;
}

.panel-header {
  margin-bottom: 14px;
}

.search-field {
  min-width: min(360px, 44vw);
}

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

.compact-filter {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.filter-bar.status-only {
  grid-template-columns: minmax(180px, 260px);
}

.search-field input,
label input,
label select,
label textarea,
#decisionForm textarea,
#decisionForm input,
#decisionForm select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  outline: none;
}

.search-field input {
  min-height: 42px;
  padding: 0 12px;
}

.password-field {
  position: relative;
  display: block;
}

.password-field input {
  padding-right: 48px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 6px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
}

.password-toggle:hover {
  background: var(--surface-strong);
  color: var(--ink);
}

.request-list {
  display: grid;
  gap: 10px;
}

.request-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 280px);
  align-items: start;
  gap: 12px;
  width: 100%;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  text-align: left;
}

.request-item:hover,
.request-item.active {
  border-color: var(--primary);
  background: #f7fcfb;
}

.request-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.request-title strong {
  overflow-wrap: anywhere;
}

.request-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  color: var(--muted);
  font-size: 13px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 0 9px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.request-item > .badge {
  justify-self: end;
  max-width: 280px;
  min-height: 30px;
  padding: 6px 10px;
  border-radius: 8px;
  line-height: 1.25;
  text-align: center;
  white-space: normal;
}

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

.badge.approved,
.badge.completed {
  background: var(--success-soft);
  color: var(--success);
}

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

.badge.kiv {
  background: #ece7ff;
  color: #5a3db8;
}

.badge.progress {
  background: var(--info-soft);
  color: var(--info);
}

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

.kpi-strip div {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.kpi-strip span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.kpi-strip strong {
  overflow-wrap: anywhere;
}

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

.detail-row {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr);
  gap: 12px;
  font-size: 14px;
}

.detail-row span:first-child {
  color: var(--muted);
  font-weight: 700;
}

.approval-steps,
.timeline {
  display: grid;
  gap: 12px;
  margin-top: 10px;
}

.step,
.timeline-item {
  position: relative;
  padding-left: 28px;
}

.step::before,
.timeline-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--line);
}

.step.done::before,
.timeline-item.done::before {
  background: var(--primary);
}

.step.rejected::before {
  background: var(--danger);
}

.step strong,
.timeline-item strong {
  display: block;
  font-size: 14px;
}

.step small,
.timeline-item small {
  color: var(--muted);
}

.image-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.image-strip img,
.photo-preview img {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--line);
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 430px;
  text-align: center;
}

.empty-state p {
  max-width: 320px;
}

.empty-art {
  width: 170px;
  height: 120px;
  margin-bottom: 18px;
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(15, 118, 110, 0.18) 0 40%, transparent 40%),
    linear-gradient(0deg, #ffffff 0 68%, transparent 68%),
    linear-gradient(135deg, #d8f3ef, #e5eefc);
  border: 1px solid var(--line);
  box-shadow: inset 20px -18px 0 rgba(35, 86, 167, 0.1);
}

.form-panel {
  padding: 18px;
}

.form-panel h3 {
  margin-bottom: 14px;
}

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

.conditional-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

label {
  display: grid;
  gap: 8px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 750;
}

label input,
label select {
  min-height: 44px;
  padding: 0 12px;
}

label textarea,
#decisionForm textarea {
  min-height: 120px;
  resize: vertical;
  padding: 12px;
}

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

.file-drop {
  padding: 18px;
  border: 1px dashed #a8bac9;
  border-radius: 8px;
  background: #f8fbfc;
}

.file-drop small {
  color: var(--muted);
  font-weight: 500;
}

.extra-summary {
  margin: 4px 0 0;
  font-size: 13px;
}

.photo-preview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.form-actions {
  margin-top: 18px;
  justify-content: flex-end;
}

.approval-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}

.approval-card {
  display: grid;
  gap: 14px;
  padding: 16px;
}

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

.progress-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.stage-column {
  min-height: 420px;
  padding: 14px;
}

.stage-column h3 {
  margin-bottom: 12px;
}

.stage-list {
  display: grid;
  gap: 10px;
}

.stage-card {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.stage-card strong {
  display: block;
  margin-bottom: 8px;
  overflow-wrap: anywhere;
}

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

.data-table {
  width: 100%;
  min-width: 920px;
  border-collapse: collapse;
  font-size: 14px;
}

.data-table th,
.data-table td {
  border-bottom: 1px solid var(--line);
  padding: 12px 10px;
  text-align: left;
  vertical-align: middle;
}

.data-table th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.data-table tbody tr {
  cursor: pointer;
}

.data-table tbody tr:hover,
.data-table .selected-row {
  background: #f7fcfb;
}

.table-link {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--primary);
  font: inherit;
  font-weight: 800;
  text-align: left;
  cursor: pointer;
}

.table-link:hover {
  text-decoration: underline;
}

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

.user-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  box-shadow: none;
}

.user-card strong,
.user-card span {
  display: block;
}

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

.user-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.user-meta span {
  min-height: 26px;
  border-radius: 999px;
  padding: 5px 9px;
  background: var(--surface-strong);
  color: var(--ink);
  font-weight: 750;
}

.password-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.approver-picker {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: #ffffff;
}

.email-log {
  display: grid;
  gap: 10px;
  max-height: 360px;
  overflow: auto;
}

.recent-updates {
  display: grid;
  gap: 10px;
  max-height: 420px;
  overflow: auto;
}

.email-item,
.update-item {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.email-item strong,
.email-item span,
.update-item strong,
.update-item span {
  display: block;
}

.email-item span,
.email-item p,
.update-item span,
.update-item p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.print-sheet {
  display: none;
}

dialog {
  width: min(520px, calc(100vw - 28px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(15, 24, 32, 0.45);
}

#decisionForm {
  display: grid;
  gap: 16px;
  padding: 18px;
}

.dialog-header h3 {
  margin: 0;
}

.dialog-actions {
  justify-content: flex-end;
}

.mobile-nav {
  display: none;
}

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

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

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

  .kpi-layout,
  .admin-layout,
  .status-update-layout {
    grid-template-columns: 1fr;
  }

  .detail-panel {
    min-height: 420px;
  }

  .progress-board {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 16px;
  }

  .nav-list {
    display: none;
  }

  .sidebar-card {
    margin-top: 12px;
  }

  .main {
    padding: 18px 14px 86px;
  }

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

  .top-actions,
  .top-actions button,
  .search-field {
    width: 100%;
  }

  .filter-bar {
    grid-template-columns: 1fr;
    width: 100%;
  }

  .metric-grid,
  .form-grid,
  .conditional-fields,
  .kpi-strip {
    grid-template-columns: 1fr;
  }

  .request-item {
    grid-template-columns: 1fr;
  }

  .request-item > .badge {
    justify-self: start;
    max-width: 100%;
  }

  .detail-row {
    grid-template-columns: 1fr;
    gap: 3px;
  }

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

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

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

  .approval-actions button,
  .form-actions button,
  .dialog-actions button {
    flex: 1;
  }

  .mobile-nav {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 20;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    border-top: 1px solid var(--line);
    background: #ffffff;
    box-shadow: 0 -10px 26px rgba(36, 48, 70, 0.08);
  }

  .mobile-item {
    display: grid;
    place-items: center;
    gap: 3px;
    min-height: 62px;
    color: var(--muted);
    font-size: 18px;
  }

  .mobile-item span {
    font-size: 10px;
    font-weight: 800;
  }

  .mobile-item.active {
    color: var(--primary);
  }
}

@media print {
  body {
    background: #ffffff;
  }

  .login-screen,
  .app-shell,
  .mobile-nav,
  dialog {
    display: none !important;
  }

  .print-sheet {
    display: block;
    color: #111827;
    font-family: Arial, sans-serif;
  }

  .print-header {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    border-bottom: 2px solid #111827;
    padding-bottom: 16px;
    margin-bottom: 20px;
  }

  .print-header h1 {
    margin: 0 0 6px;
    font-size: 26px;
  }

  .print-header p,
  .print-field span {
    margin: 0;
    color: #4b5563;
  }

  .print-header strong {
    font-size: 22px;
  }

  .print-section {
    break-inside: avoid;
    margin-bottom: 22px;
  }

  .print-section h2 {
    margin: 0 0 10px;
    font-size: 16px;
  }

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

  .print-field {
    border: 1px solid #d1d5db;
    padding: 9px;
    min-height: 54px;
  }

  .print-field span,
  .print-field strong {
    display: block;
  }

  .print-field strong {
    margin-top: 4px;
    font-size: 13px;
  }

  .print-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
  }

  .print-table th,
  .print-table td {
    border: 1px solid #d1d5db;
    padding: 8px;
    text-align: left;
    vertical-align: top;
  }

  .print-table th {
    background: #f3f4f6;
  }

  .print-signatures {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-top: 40px;
  }

  .print-signatures div {
    border-top: 1px solid #111827;
    padding-top: 8px;
    min-height: 50px;
    font-size: 12px;
  }
}
