﻿:root {
  color-scheme: light;
  --bs-body-font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  --bg: oklch(0.972 0.006 215);
  --surface: oklch(1 0 0);
  --surface-soft: oklch(0.985 0.004 215);
  --sidebar: oklch(0.205 0.035 220);
  --sidebar-2: oklch(0.255 0.042 218);
  --sidebar-muted: oklch(0.77 0.025 220);
  --ink: oklch(0.205 0.025 230);
  --muted: oklch(0.47 0.02 230);
  --line: oklch(0.9 0.008 230);
  --line-strong: oklch(0.82 0.014 225);
  --accent: oklch(0.57 0.13 180);
  --accent-strong: oklch(0.49 0.125 180);
  --accent-soft: oklch(0.94 0.045 180);
  --danger: oklch(0.55 0.18 29);
  --ok: oklch(0.55 0.14 150);
  --warn: oklch(0.67 0.15 70);
  --shadow-sm: 0 1px 2px oklch(0.22 0.025 230 / 0.05);
  --shadow-md: 0 10px 24px oklch(0.22 0.025 230 / 0.08);
  --radius: 12px;
  --radius-sm: 9px;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background:
    linear-gradient(90deg, oklch(0.93 0.045 180 / 0.72) 0, transparent 28rem),
    linear-gradient(180deg, var(--bg), oklch(0.955 0.006 225));
  color: var(--ink);
  font-family: var(--bs-body-font-family);
  font-size: 14px;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 3px solid oklch(0.76 0.1 190);
  outline-offset: 2px;
}

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

h1 {
  font-size: 1.45rem;
  line-height: 1.25;
  font-weight: 800;
}

h2 {
  font-size: 1.55rem;
  line-height: 1.2;
  font-weight: 850;
}

h3 {
  font-size: 1rem;
  line-height: 1.3;
  font-weight: 800;
}

a {
  color: var(--accent-strong);
  text-decoration: none;
  font-weight: 700;
}

a:hover {
  text-decoration: underline;
}

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

.login-view {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.login-card {
  display: grid;
  gap: 24px;
  width: min(440px, 100%);
  padding: 28px;
  border: 1px solid oklch(0.94 0.01 220);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

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

.brand-row p,
.muted,
.help-text {
  color: var(--muted);
  line-height: 1.6;
}

.brand-mark {
  display: grid;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 13px;
  background: linear-gradient(135deg, var(--accent), oklch(0.48 0.13 195));
  color: white;
  box-shadow: 0 8px 18px oklch(0.5 0.13 185 / 0.22);
  font-size: 1.15rem;
  font-weight: 900;
}

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

.form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: end;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 44px;
  padding: 0 13px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background-color: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 2px oklch(0.22 0.025 230 / 0.04);
}

select {
  appearance: none;
  padding-right: 40px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 19px) 50%,
    calc(100% - 14px) 50%;
  background-repeat: no-repeat;
  background-size: 5px 5px, 5px 5px;
}

input[type="date"] {
  padding-right: 10px;
}

input[type="number"] {
  font-variant-numeric: tabular-nums;
}

input::placeholder {
  color: oklch(0.62 0.016 230);
}

input:hover,
select:hover {
  border-color: oklch(0.72 0.035 210);
  background-color: oklch(0.995 0.002 220);
}

input:focus,
select:focus {
  border-color: var(--accent);
  background-color: white;
  box-shadow: 0 0 0 3px oklch(0.86 0.06 185 / 0.55);
  outline: 0;
}

input:disabled,
select:disabled {
  background: oklch(0.95 0.005 220);
  color: oklch(0.58 0.015 230);
  cursor: not-allowed;
}

.file-picker {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  min-height: 132px;
  padding: 18px;
  border: 1.5px dashed oklch(0.7 0.08 185);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, oklch(0.94 0.045 180), oklch(0.985 0.016 190)),
    var(--accent-soft);
  cursor: pointer;
  overflow: hidden;
}

.file-picker:hover,
.file-picker.is-dragging {
  border-color: var(--accent);
  background:
    linear-gradient(135deg, oklch(0.91 0.06 180), oklch(0.975 0.02 190)),
    var(--accent-soft);
  box-shadow: 0 8px 18px oklch(0.5 0.13 185 / 0.12);
}

.file-picker.has-file {
  border-style: solid;
  border-color: oklch(0.62 0.105 180);
}

.file-picker input[type="file"] {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  cursor: pointer;
}

.file-picker-icon {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  border-radius: 16px;
  background: white;
  color: var(--accent-strong);
  box-shadow: var(--shadow-sm);
  font-size: 1.45rem;
}

.file-picker-copy {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.file-picker-copy strong {
  color: var(--ink);
  font-size: 1rem;
}

.file-picker-copy em {
  overflow: hidden;
  color: var(--muted);
  font-style: normal;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.primary-button,
.secondary-button,
.ghost-button,
.text-button,
.icon-button,
.nav-item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.primary-button {
  min-width: 140px;
  padding: 0 16px;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: white;
  box-shadow: 0 8px 16px oklch(0.5 0.13 185 / 0.18);
}

.primary-button:hover {
  filter: brightness(0.98);
  box-shadow: 0 10px 20px oklch(0.5 0.13 185 / 0.24);
}

.secondary-button {
  padding: 0 14px;
  border: 1px solid oklch(0.77 0.055 185);
  background: var(--accent-soft);
  color: oklch(0.33 0.095 185);
}

.secondary-button:hover,
.text-button:hover {
  background: oklch(0.91 0.06 185);
}

.ghost-button {
  width: 100%;
  padding: 0 14px;
  border: 1px solid oklch(0.38 0.035 220);
  background: oklch(0.245 0.036 220);
  color: white;
}

.ghost-button:hover {
  background: oklch(0.31 0.04 220);
}

.text-button {
  min-height: 32px;
  padding: 0 10px;
  background: transparent;
  color: var(--accent-strong);
}

.icon-button {
  width: 36px;
  min-height: 36px;
  padding: 0;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--muted);
}

.icon-button:hover {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.error-text {
  color: var(--danger);
  font-weight: 700;
}

.main-view {
  display: grid;
  grid-template-columns: 252px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  height: 100vh;
  padding: 20px 16px;
  background:
    linear-gradient(180deg, var(--sidebar), oklch(0.17 0.03 220)),
    var(--sidebar);
  color: white;
}

.side-brand {
  padding: 2px 4px 18px;
  border-bottom: 1px solid oklch(0.34 0.03 220);
}

.side-brand strong {
  display: block;
  line-height: 1.2;
}

.side-brand span {
  display: block;
  margin-top: 4px;
  color: var(--sidebar-muted);
  font-size: 0.82rem;
}

.nav-list {
  display: grid;
  align-content: start;
  gap: 6px;
  margin-top: 22px;
}

.nav-item {
  justify-content: flex-start;
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  background: transparent;
  color: var(--sidebar-muted);
  text-align: left;
}

.nav-item i {
  width: 18px;
  font-size: 1rem;
  text-align: center;
}

.nav-item:hover {
  background: oklch(0.28 0.04 220);
  color: white;
}

.nav-item.active {
  background: oklch(0.31 0.045 220);
  color: white;
  box-shadow: inset 3px 0 0 var(--accent);
}

.content-shell {
  min-width: 0;
  padding: 26px 30px 40px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: min(1280px, 100%);
  margin: 0 auto 18px;
  padding: 18px 0 4px;
}

.topbar .muted:first-child {
  margin-bottom: 2px;
  font-weight: 700;
}

.view-panel {
  width: min(1280px, 100%);
  margin: 0 auto;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.metric-card,
.panel {
  border: 1px solid oklch(0.92 0.008 230);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.metric-card {
  display: grid;
  gap: 8px;
  padding: 18px;
}

.metric-card span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.metric-card strong {
  color: var(--ink);
  font-size: 1.8rem;
  line-height: 1;
}

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

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

.view-panel > .panel + .panel,
.view-panel > .two-column + .panel,
.view-panel > .two-column + .two-column,
.view-panel > .panel + .two-column {
  margin-top: 16px;
}

.panel-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-actions,
.modal-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.assignment-form {
  grid-template-columns: minmax(180px, 1.1fr) minmax(180px, 1.1fr) minmax(160px, 0.8fr) minmax(180px, 1fr) auto;
}

.employee-form {
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) minmax(180px, 1fr) minmax(180px, 1fr) auto;
}

.employee-credit-form {
  grid-template-columns: minmax(220px, 1.2fr) minmax(180px, 0.8fr) minmax(220px, 1fr) auto;
}

.modal-dialog {
  width: min(560px, calc(100vw - 32px));
  padding: 0;
  border: 0;
  border-radius: 16px;
  background: transparent;
  color: var(--ink);
}

.modal-dialog::backdrop {
  background: oklch(0.16 0.025 225 / 0.5);
  backdrop-filter: blur(4px);
}

.modal-card {
  margin: 0;
  padding: 20px;
  border: 1px solid oklch(0.92 0.008 230);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.modal-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

table {
  width: 100%;
  min-width: 100%;
  border-collapse: collapse;
  background: var(--surface);
}

#view-stores table {
  min-width: 900px;
}

#view-employees table,
#view-credits table {
  min-width: 720px;
}

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

th {
  background: oklch(0.978 0.005 220);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
}

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

.compact-list,
.schedule-list,
.job-list {
  display: grid;
  gap: 10px;
}

.list-item,
.schedule-item,
.job-item {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
}

.schedule-item {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 850;
}

.badge.failed {
  background: oklch(0.94 0.05 29);
  color: var(--danger);
}

.badge.completed {
  background: oklch(0.93 0.05 150);
  color: var(--ok);
}

.app-toast {
  position: fixed;
  left: 50%;
  top: 36px;
  z-index: 120;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  max-width: min(520px, calc(100vw - 32px));
  min-height: 58px;
  padding: 0 24px;
  border: 1px solid oklch(0.92 0.012 160);
  border-radius: 12px;
  background: white;
  color: oklch(0.67 0.16 150);
  box-shadow: 0 12px 30px oklch(0.22 0.025 230 / 0.16);
  font-size: 1.06rem;
  font-weight: 800;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -10px);
}

.app-toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.app-toast i {
  color: oklch(0.7 0.16 150);
  font-size: 1.22rem;
}

.app-toast.error {
  border-color: oklch(0.91 0.035 28);
  color: var(--danger);
}

.app-toast.error i {
  color: var(--danger);
}

[hidden] {
  display: none !important;
}

@media (max-width: 980px) {
  body {
    background: var(--bg);
  }

  .main-view {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    grid-template-rows: auto auto auto;
    gap: 14px;
    padding: 14px;
  }

  .side-brand {
    padding-bottom: 12px;
  }

  .nav-list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    margin-top: 0;
  }

  .nav-item {
    justify-content: center;
    min-height: 40px;
    padding: 0 10px;
  }

  .nav-item.active {
    box-shadow: inset 0 -3px 0 var(--accent);
  }

  .content-shell {
    padding: 18px 14px 28px;
  }

  .topbar,
  .panel-head,
  .modal-head {
    align-items: stretch;
    flex-direction: column;
  }

  .metric-grid,
  .panel-grid,
  .two-column,
  .form-grid,
  .assignment-form,
  .employee-form,
  .employee-credit-form {
    grid-template-columns: 1fr;
  }

  .panel-actions,
  .modal-actions {
    align-items: stretch;
    flex-direction: column;
  }

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

@media (max-width: 620px) {
  body {
    font-size: 13px;
  }

  .login-card,
  .panel,
  .metric-card {
    border-radius: 12px;
    padding: 16px;
  }

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

  .nav-item span,
  .ghost-button span {
    overflow: hidden;
    text-overflow: ellipsis;
  }

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

  .content-shell {
    padding-inline: 12px;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .primary-button,
  .secondary-button,
  .ghost-button,
  .nav-item,
  .file-picker,
  .app-toast,
  input,
  select {
    transition: background-color 160ms ease, color 160ms ease, transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease, filter 160ms ease;
  }

  .primary-button:active,
  .secondary-button:active,
  .nav-item:active {
    transform: translateY(1px);
  }
}

