:root {
  color-scheme: light;
  --bg: #f5f7f8;
  --surface: #ffffff;
  --surface-2: #eef3f4;
  --text: #172326;
  --muted: #66767b;
  --line: #dbe4e6;
  --primary: #0f766e;
  --primary-strong: #115e59;
  --accent: #b45309;
  --danger: #b91c1c;
  --ok: #15803d;
  --info: #2563eb;
  --shadow: 0 10px 30px rgba(23, 35, 38, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

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

button {
  border: 0;
  cursor: pointer;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 420px) 1fr;
  background: linear-gradient(90deg, #ffffff 0%, #ffffff 36%, #e8f2f1 36%, #e8f2f1 100%);
}

.login-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 40px;
  background: var(--surface);
}

.login-aside {
  display: flex;
  flex-direction: column;
  justify-content: end;
  padding: 56px;
  color: #f8fafc;
  background:
    linear-gradient(rgba(15, 42, 45, 0.42), rgba(15, 42, 45, 0.72)),
    url("https://images.unsplash.com/photo-1504917595217-d4dc5ebe6122?auto=format&fit=crop&w=1400&q=80") center/cover;
}

.brand {
  margin: 0 0 8px;
  font-size: 30px;
  line-height: 1.1;
}

.subtitle {
  margin: 0 0 28px;
  color: var(--muted);
}

.login-aside .subtitle {
  max-width: 620px;
  color: #dce7e9;
}

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

.sidebar {
  padding: 20px 16px;
  background: #102326;
  color: #eef7f8;
}

.sidebar-title {
  margin: 0 0 4px;
  font-size: 20px;
}

.sidebar-meta {
  margin: 0 0 24px;
  color: #a8bfc3;
  font-size: 13px;
}

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

.nav button {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border-radius: 6px;
  color: #dce7e9;
  background: transparent;
  text-align: left;
}

.nav button.active,
.nav button:hover {
  background: #1c3a3f;
  color: #ffffff;
}

.content {
  min-width: 0;
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.topbar h1 {
  margin: 0;
  font-size: 24px;
}

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

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

.panel {
  grid-column: span 12;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

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

.panel-title {
  margin: 0;
  font-size: 16px;
}

.panel-body {
  padding: 18px;
}

.stat {
  grid-column: span 3;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.stat strong {
  display: block;
  font-size: 28px;
}

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

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

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

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

label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

input,
select,
textarea {
  width: 100%;
  min-height: 40px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
}

textarea {
  resize: vertical;
}

.inline-check {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}

.inline-check input {
  width: auto;
  min-height: auto;
}

.check-list {
  max-height: 300px;
  overflow: auto;
  display: grid;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
}

.check-item {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: start;
  gap: 10px;
  padding: 8px;
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
}

.check-item input {
  width: auto;
  min-height: auto;
  margin-top: 4px;
}

.check-item small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
}

.btn {
  min-height: 40px;
  padding: 9px 14px;
  border-radius: 6px;
  background: var(--primary);
  color: #ffffff;
  font-weight: 700;
}

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

.btn.secondary {
  background: #e5ecee;
  color: var(--text);
}

.btn.warn {
  background: var(--accent);
}

.btn.danger {
  background: var(--danger);
}

.btn.icon {
  width: 38px;
  padding: 0;
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.table-wrap {
  overflow: auto;
}

.table-input {
  min-width: 140px;
  min-height: 34px;
  padding: 6px 8px;
  font-size: 13px;
}

.table-assignment {
  display: grid;
  gap: 4px;
  min-width: 220px;
  margin-bottom: 8px;
}

.table-assignment span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

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

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

th {
  position: sticky;
  top: 0;
  background: var(--surface-2);
  color: #314247;
  font-size: 12px;
  text-transform: uppercase;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #e8f2f1;
  color: var(--primary-strong);
  font-size: 12px;
  font-weight: 700;
}

.pill.gray {
  background: #eef2f3;
  color: #526166;
}

.pill.blue {
  background: #e8f0ff;
  color: var(--info);
}

.pill.green {
  background: #e8f7ee;
  color: var(--ok);
}

.pill.warn {
  background: #fff3df;
  color: var(--accent);
}

.planner-status {
  min-width: 108px;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 6px 28px 6px 10px;
  font-size: 12px;
  font-weight: 700;
}

.planner-status.green {
  background-color: #e8f7ee;
  color: var(--ok);
}

.planner-status.warn {
  background-color: #fff3df;
  color: var(--accent);
}

.planner-status.gray {
  background-color: #eef2f3;
  color: #526166;
}

.empty {
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

.notice {
  margin: 0 0 16px;
  padding: 12px 14px;
  border-left: 4px solid var(--primary);
  background: #e8f2f1;
  color: #24474b;
}

.error {
  margin: 0 0 14px;
  color: var(--danger);
  font-weight: 700;
}

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

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

.mobile-item {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.mobile-item h3 {
  margin: 0 0 6px;
  font-size: 16px;
}

.mobile-item p {
  margin: 4px 0;
  color: var(--muted);
}

.flash-report {
  background: #ffffff;
}

.flash-title {
  padding: 8px;
  border: 2px solid #000000;
  background: #8ff0bd;
  color: #000000;
  font-size: 18px;
  font-weight: 800;
  text-align: center;
  text-transform: uppercase;
}

.flash-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  padding: 10px 0;
}

.flash-method {
  margin-top: 14px;
  border: 2px solid #1d4ed8;
}

.flash-method h3 {
  margin: 0;
  padding: 9px;
  border-bottom: 2px solid #000000;
  background: #8ff0bd;
  color: #000000;
  font-size: 18px;
  text-align: center;
}

.flash-table th {
  position: static;
  border: 1px solid #000000;
  background: #8ff0bd;
  color: #000000;
  text-align: center;
}

.flash-table td {
  border: 1px solid #000000;
  vertical-align: middle;
}

.flash-state {
  width: 150px;
  text-align: center;
}

.flash-state strong,
.flash-state b,
.flash-state span,
.flash-state small {
  display: block;
  margin: 10px 0;
}

.flash-state b {
  color: #ff0000;
}

.flash-photo {
  display: grid;
  place-items: center;
  min-width: 280px;
  min-height: 210px;
  margin: 0;
  background: #f8fafc;
}

.flash-photo img {
  width: 100%;
  max-height: 320px;
  object-fit: contain;
}

.photo-placeholder,
.empty-photo {
  width: 100%;
  min-height: 210px;
  display: grid;
  place-items: center;
  padding: 12px;
  border: 1px dashed var(--line);
  color: var(--muted);
  text-align: center;
  overflow-wrap: anywhere;
}

.flash-photo figcaption {
  width: 100%;
  padding: 4px;
  background: #fff7cc;
  color: #000000;
  font-weight: 700;
  text-align: center;
}

@media print {
  .sidebar,
  .topbar,
  .flash-report .panel-header .toolbar {
    display: none;
  }

  .app-shell {
    display: block;
  }

  .content {
    padding: 0;
  }

  .panel {
    border: 0;
    box-shadow: none;
  }
}

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

  .login-aside {
    min-height: 260px;
    padding: 28px;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 5;
  }

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

  .content {
    padding: 16px;
  }

  .stat {
    grid-column: span 6;
  }

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

@media (max-width: 560px) {
  .login-panel {
    padding: 24px;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .stat {
    grid-column: span 12;
  }
}
