:root {
  color-scheme: light;
  --page: #f6f7f9;
  --surface: #ffffff;
  --surface-soft: #eef2f6;
  --text: #18212f;
  --muted: #5a6677;
  --border: #cfd7e3;
  --accent: #0f766e;
  --accent-strong: #115e59;
  --danger: #b42318;
  --shadow: 0 12px 32px rgba(24, 33, 47, 0.10);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--page);
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.5;
}

a {
  color: inherit;
  text-decoration: none;
}

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

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

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  padding: 0 32px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  font-weight: 700;
}

.brand-mark {
  display: inline-grid;
  width: 36px;
  height: 36px;
  place-items: center;
  color: #ffffff;
  background: var(--accent);
  border-radius: 8px;
  font-size: 0.85rem;
}

.page {
  width: min(1040px, calc(100% - 32px));
  margin: 0 auto;
  padding: 48px 0;
}

.login-panel {
  width: min(440px, 100%);
  margin: 64px auto 0;
  padding: 32px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: 2rem;
  line-height: 1.15;
}

h2 {
  margin: 0;
  font-size: 1.4rem;
  line-height: 1.2;
}

.login-form {
  display: grid;
  gap: 12px;
  margin-top: 28px;
}

.login-form label {
  color: var(--muted);
  font-size: 0.94rem;
  font-weight: 700;
}

.login-form input {
  min-height: 44px;
  width: 100%;
  padding: 9px 11px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.login-form input:focus {
  outline: 3px solid rgba(15, 118, 110, 0.22);
  border-color: var(--accent);
}

.primary-action,
.secondary-action {
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 700;
}

.primary-action {
  margin-top: 8px;
  color: #ffffff;
  background: var(--accent);
}

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

.primary-link,
.secondary-link,
.link-action {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  font-weight: 700;
}

.primary-link {
  padding: 0 14px;
  color: #ffffff;
  background: var(--accent);
}

.primary-link:hover,
.primary-link:focus {
  background: var(--accent-strong);
}

.secondary-action {
  padding: 0 14px;
  color: var(--text);
  background: var(--surface-soft);
}

.secondary-link,
.link-action {
  padding: 0 12px;
  color: var(--text);
  background: var(--surface-soft);
}

.link-action {
  border: 0;
  cursor: pointer;
}

.danger-action {
  color: var(--danger);
}

.muted-text {
  color: var(--muted);
}

.form-error {
  margin: 0;
  padding: 10px 12px;
  color: var(--danger);
  background: #fff0ee;
  border: 1px solid #f1b4ad;
  border-radius: 6px;
}

.field-error {
  padding: 8px 10px;
}

.form-success {
  margin: 0 0 16px;
  padding: 10px 12px;
  color: #0f5132;
  background: #e8f5ee;
  border: 1px solid #a8d8bd;
  border-radius: 6px;
}

.dashboard-header {
  display: grid;
  gap: 8px;
  margin-bottom: 24px;
}

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

.module-tile {
  display: grid;
  min-height: 116px;
  align-content: space-between;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 14px rgba(24, 33, 47, 0.06);
}

.module-tile:hover,
.module-tile:focus {
  outline: 3px solid rgba(15, 118, 110, 0.18);
  border-color: var(--accent);
}

.module-tile span {
  color: var(--muted);
}

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

.subsection-header {
  margin-top: 32px;
}

.data-panel,
.detail-form,
.empty-state {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 14px rgba(24, 33, 47, 0.06);
}

.data-panel {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.data-table th {
  color: var(--muted);
  font-size: 0.86rem;
  text-transform: uppercase;
}

.data-table tr:last-child td {
  border-bottom: 0;
}

.status-badge {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 700;
}

.status-badge.is-active {
  color: #0f5132;
  background: #e8f5ee;
}

.status-badge.is-inactive {
  color: #5a6677;
  background: var(--surface-soft);
}

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

.detail-form {
  display: grid;
  gap: 18px;
  max-width: 640px;
  padding: 24px;
}

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

.form-field label,
.form-field .field-label,
.checkbox-field {
  color: var(--muted);
  font-size: 0.94rem;
  font-weight: 700;
}

.form-field input,
.form-field select,
.form-field textarea {
  min-height: 44px;
  width: 100%;
  padding: 9px 11px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.form-field textarea {
  resize: vertical;
}

.readonly-field {
  min-height: 44px;
  margin: 0;
  padding: 9px 11px;
  color: var(--text);
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  outline: 3px solid rgba(15, 118, 110, 0.22);
  border-color: var(--accent);
}

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

.checkbox-field {
  display: inline-flex;
  gap: 10px;
  align-items: center;
}

.checkbox-field input {
  width: 18px;
  height: 18px;
}

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

.form-actions .primary-action {
  min-width: 128px;
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
}

.header-actions .primary-action {
  margin-top: 0;
  padding: 0 14px;
}

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

.summary-item {
  display: grid;
  gap: 4px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.summary-item span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
  text-transform: uppercase;
}

.summary-item strong {
  font-size: 1.7rem;
  line-height: 1.1;
}

.message-panel {
  margin-bottom: 16px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.message-panel.conflicts {
  border-color: #f1b4ad;
}

.message-panel.warnings {
  border-color: #e7c970;
}

.message-panel h2,
.schedule-panel h2 {
  margin: 0 0 10px;
  font-size: 1.08rem;
}

.message-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 20px;
}

.schedule-panel {
  margin-top: 16px;
}

.schedule-panel h2 {
  padding: 16px 16px 0;
}

.empty-state {
  display: grid;
  gap: 14px;
  padding: 24px;
}

@media (max-width: 760px) {
  .topbar {
    padding: 0 16px;
  }

  .page {
    padding: 28px 0;
  }

  .login-panel {
    margin-top: 24px;
    padding: 24px;
  }

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

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

  .primary-link,
  .secondary-link {
    width: 100%;
  }

  .header-actions,
  .header-actions form,
  .header-actions .primary-action {
    width: 100%;
  }

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

  .data-table {
    min-width: 620px;
  }

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