:root {
  --bg: #f5f7f8;
  --panel: #ffffff;
  --panel-2: #eef4f3;
  --ink: #111827;
  --muted: #5f6b76;
  --line: #d9e1e4;
  --teal: #0f766e;
  --teal-dark: #115e59;
  --blue: #2563eb;
  --green: #15803d;
  --amber: #b45309;
  --red: #b91c1c;
  --slate: #334155;
  --shadow: 0 8px 24px rgba(17, 24, 39, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  min-height: 100%;
  margin: 0;
}

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

button {
  border: 0;
}

.app-shell {
  min-height: 100vh;
  padding-bottom: 136px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
}

.brand strong {
  overflow: hidden;
  color: var(--teal-dark);
  font-size: 16px;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand span {
  color: var(--muted);
  font-size: 12px;
}

.role-switch,
.segmented {
  display: inline-flex;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

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

.role-switch button,
.segmented button {
  min-height: 34px;
  padding: 0 11px;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}

.role-switch button.active,
.segmented button.active {
  color: #fff;
  background: var(--teal);
}

.content {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 16px;
}

.flash {
  margin: 0 0 14px;
  padding: 11px 12px;
  border-left: 4px solid var(--amber);
  border-radius: 8px;
  background: #fff7ed;
  color: #7c2d12;
  font-weight: 700;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.toolbar h1,
.toolbar h2 {
  margin: 0;
}

h1 {
  font-size: 30px;
  line-height: 1.05;
  letter-spacing: 0;
}

h2 {
  font-size: 21px;
  line-height: 1.18;
  letter-spacing: 0;
}

h3 {
  margin: 0;
  font-size: 16px;
  letter-spacing: 0;
}

p {
  margin: 0;
}

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

.small {
  font-size: 12px;
}

.login-shell {
  min-height: 100vh;
  background:
    linear-gradient(90deg, rgba(15, 118, 110, 0.08) 1px, transparent 1px),
    linear-gradient(180deg, rgba(15, 118, 110, 0.06) 1px, transparent 1px),
    #f4f7f6;
  background-size: 42px 42px;
}

.login-content {
  display: grid;
  width: min(1120px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 20px;
  align-items: center;
}

.login-panel {
  display: grid;
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 22px 60px rgba(15, 23, 42, 0.14);
}

.login-brand {
  display: grid;
  gap: 12px;
  padding: 28px;
  color: #fff;
  background: #0f3f3d;
  align-content: center;
}

.login-kicker {
  width: fit-content;
  padding: 6px 9px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 999px;
  color: #b7f3df;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.login-brand h1 {
  max-width: 10ch;
  color: #fff;
  font-size: 44px;
  line-height: 0.95;
}

.login-brand p {
  color: #d5e7e3;
  font-size: 17px;
  font-weight: 800;
}

.login-status {
  display: flex;
  width: fit-content;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
}

.login-status span {
  color: #b7f3df;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.login-status strong {
  color: #fff;
  font-size: 14px;
}

.login-card {
  display: grid;
  gap: 20px;
  padding: 24px;
  align-content: center;
}

.login-card-head {
  display: grid;
  gap: 4px;
}

.login-card-head h2 {
  font-size: 28px;
}

.login-card-head span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

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

.login-form .primary {
  width: 100%;
  min-height: 52px;
  font-size: 16px;
}

.hero-work {
  display: grid;
  gap: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(135deg, #ffffff 0%, #eef7f6 100%);
  box-shadow: var(--shadow);
}

.hero-copy {
  display: grid;
  gap: 8px;
}

.hero-copy p {
  color: var(--muted);
  font-weight: 600;
}

.form-grid {
  display: grid;
  gap: 12px;
}

.field {
  display: grid;
  gap: 7px;
  color: var(--slate);
  font-size: 13px;
  font-weight: 800;
}

.field input,
.field select,
.inline-input,
.inline-select {
  width: 100%;
  height: 44px;
  max-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 11px;
  color: var(--ink);
  background: #fff;
  outline: none;
  appearance: auto;
}

.field textarea {
  width: 100%;
  min-height: 86px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 11px;
  color: var(--ink);
  background: #fff;
  outline: none;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.inline-input:focus,
.inline-select:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
}

.primary,
.secondary,
.danger,
.ghost,
.file-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 800;
  text-decoration: none;
}

.primary {
  color: #fff;
  background: var(--teal);
}

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

.secondary,
.file-button {
  border: 1px solid var(--line);
  color: var(--teal-dark);
  background: #fff;
}

.danger {
  color: #fff;
  background: var(--red);
}

.ghost {
  color: var(--slate);
  background: transparent;
}

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

.button-row.tight {
  align-items: center;
  justify-content: flex-end;
}

.stock-stepper {
  display: grid;
  grid-template-columns: 52px minmax(90px, 1fr) 52px;
  align-items: center;
  gap: 8px;
}

.stock-stepper button {
  min-width: 52px;
  min-height: 48px;
  padding: 0;
  font-size: 22px;
  line-height: 1;
}

.stock-stepper span {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--slate);
  background: #f8fafc;
  font-weight: 900;
}

.summary-grid,
.section-grid,
.dashboard-grid,
.proof-grid,
.stat-grid {
  display: grid;
  gap: 12px;
}

.summary-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 16px;
}

.stat-card,
.section-card,
.task-card,
.panel,
.queue-item,
.proof-tile {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

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

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

.stat-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.section-grid {
  margin-top: 16px;
}

.section-card {
  display: grid;
  gap: 10px;
  padding: 16px;
  text-align: left;
  cursor: pointer;
}

.section-card:hover {
  border-color: var(--teal);
}

.section-card strong {
  font-size: 20px;
}

.section-card span {
  color: var(--muted);
  line-height: 1.35;
}

.card-count {
  width: fit-content;
  padding: 5px 9px;
  border-radius: 999px;
  color: #0f172a;
  background: #e2e8f0;
  font-size: 12px;
  font-weight: 900;
}

.task-list,
.queue-list,
.check-list {
  display: grid;
  gap: 10px;
}

.task-card {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.task-head,
.queue-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.task-meta,
.queue-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.pill,
.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}

.pill {
  color: var(--slate);
  background: #e2e8f0;
}

.status-not_started {
  color: #334155;
  background: #e2e8f0;
}

.status-in_progress {
  color: #075985;
  background: #dbeafe;
}

.status-submitted {
  color: #854d0e;
  background: #fef3c7;
}

.status-approved {
  color: #166534;
  background: #dcfce7;
}

.status-rejected,
.status-rework_required,
.status-not_completed {
  color: #991b1b;
  background: #fee2e2;
}

.progress-bar {
  width: 100%;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e2e8f0;
}

.progress-bar span {
  display: block;
  height: 100%;
  background: var(--teal);
}

.panel {
  display: grid;
  gap: 14px;
  padding: 14px;
}

.detail-shell {
  display: grid;
  gap: 14px;
}

.check-row {
  display: grid;
  grid-template-columns: 24px 1fr;
  align-items: start;
  gap: 9px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.check-row input {
  width: 20px;
  height: 20px;
  margin: 1px 0 0;
}

.proof-grid {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.proof-tile {
  display: grid;
  gap: 8px;
  padding: 12px;
}

.proof-tile strong {
  font-size: 14px;
}

.proof-tile input[type="file"] {
  display: none;
}

.proof-ok {
  color: var(--green);
  font-weight: 900;
}

.proof-needed {
  color: var(--red);
  font-weight: 900;
}

.bottom-nav {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(68px, 1fr));
  gap: 4px;
  padding: 8px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(14px);
}

.bottom-nav button {
  min-height: 48px;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: 12px;
  font-weight: 900;
}

.bottom-nav button.active {
  color: #fff;
  background: var(--teal);
}

.report-fab {
  position: fixed;
  right: 14px;
  bottom: 82px;
  z-index: 35;
  min-height: 48px;
  padding: 0 14px;
  border-radius: 999px;
  color: #fff;
  background: var(--red);
  box-shadow: var(--shadow);
  cursor: pointer;
  font-weight: 900;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
}

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

th {
  color: var(--muted);
  background: #f8fafc;
  font-size: 12px;
  text-transform: uppercase;
}

.queue-item {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.room-list-button {
  width: 100%;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.room-list-button:hover {
  border-color: var(--teal);
}

.low-stock {
  border-color: #f59e0b;
  background: #fffbeb;
}

.log-error {
  border-color: #ef4444;
}

.log-warning {
  border-color: #f59e0b;
}

.log-info {
  border-color: #14b8a6;
}

.neutral-list {
  background: #f8fafc;
  color: var(--slate);
}

.issue-strip {
  padding: 10px;
  border-left: 4px solid var(--red);
  border-radius: 8px;
  background: #fff1f2;
  color: #7f1d1d;
}

.two-col {
  display: grid;
  gap: 14px;
}

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

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

.summary-box {
  width: 100%;
  min-height: 220px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
  color: var(--ink);
  resize: vertical;
}

.blocked-list {
  display: grid;
  gap: 7px;
  padding: 10px;
  border-radius: 8px;
  background: #fff7ed;
  color: #7c2d12;
  font-weight: 800;
}

.ok-list {
  padding: 10px;
  border-radius: 8px;
  background: #ecfdf5;
  color: #14532d;
  font-weight: 800;
}

@media (min-width: 720px) {
  .content {
    padding: 24px;
  }

  .login-content {
    padding: 40px;
  }

  h1 {
    font-size: 36px;
  }

  .login-panel {
    grid-template-columns: 0.95fr 1.05fr;
    min-height: 520px;
  }

  .login-brand {
    padding: 48px;
  }

  .login-brand h1 {
    font-size: 68px;
  }

  .login-card {
    padding: 48px;
  }

  .hero-work {
    grid-template-columns: 1fr 1.15fr;
    align-items: center;
    padding: 24px;
  }

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

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

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

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

  .two-col {
    grid-template-columns: 1.1fr 0.9fr;
  }

  .bottom-nav {
    right: auto;
    top: 74px;
    bottom: auto;
    left: 18px;
    width: 180px;
    grid-template-columns: 1fr;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
  }

  .app-shell {
    padding-bottom: 0;
  }

  .content {
    padding-left: 222px;
  }

  .report-fab {
    bottom: 24px;
  }
}

@media (min-width: 980px) {
  .section-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

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