:root {
  color-scheme: light;
  --ink: #18212f;
  --muted: #677084;
  --line: #d8dde7;
  --paper: #ffffff;
  --surface: #f4f6f9;
  --primary: #215f9a;
  --primary-strong: #174c7d;
  --danger: #b42318;
  --success: #0f766e;
  --warning: #b7791f;
  --shadow: 0 18px 40px rgba(22, 34, 51, 0.1);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  position: relative;
  margin: 0;
  background:
    linear-gradient(90deg, rgba(33, 95, 154, 0.06) 1px, transparent 1px) 0 0 / 42px 42px,
    linear-gradient(rgba(33, 95, 154, 0.06) 1px, transparent 1px) 0 0 / 42px 42px,
    linear-gradient(135deg, #eef3f8 0%, #f8fafc 42%, #e8eef6 100%);
  color: var(--ink);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-text-size-adjust: 100%;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(118deg, transparent 0 56%, rgba(33, 95, 154, 0.11) 56% 58%, transparent 58% 100%),
    linear-gradient(154deg, transparent 0 64%, rgba(15, 118, 110, 0.1) 64% 66%, transparent 66% 100%),
    repeating-linear-gradient(135deg, rgba(24, 33, 47, 0.035) 0 2px, transparent 2px 18px);
}

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

button {
  cursor: pointer;
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

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

.login-screen {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    linear-gradient(135deg, rgba(16, 25, 35, 0.92), rgba(24, 33, 47, 0.82)),
    url("assets/dyerlogo.png") center / 380px auto no-repeat,
    #101923;
}

.login-card {
  width: min(100%, 460px);
  display: grid;
  gap: 24px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
  padding: 28px;
}

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

.login-brand h1,
.login-copy h2 {
  margin: 0;
}

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

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

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

.login-copy p {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

.entry-form {
  display: grid;
  gap: 10px;
}

.entry-form label {
  color: #334155;
  font-size: 13px;
  font-weight: 800;
}

.entry-form input,
.entry-form select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
  padding: 12px;
}

.entry-form .primary-btn {
  margin-top: 6px;
}

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

.sidebar {
  background: #101923;
  color: #f8fafc;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

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

.brand-logo {
  width: 92px;
  height: auto;
  border-radius: 6px;
  background: #ffffff;
  padding: 6px;
  display: block;
}

.brand h1,
.topbar h2,
.panel h3,
.login-panel h2 {
  margin: 0;
}

.brand h1 {
  font-size: 22px;
  line-height: 1.05;
}

.eyebrow {
  margin: 0 0 6px;
  color: #92a4ba;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.login-panel {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.login-panel label {
  color: #cbd5e1;
  font-size: 13px;
  font-weight: 700;
}

.login-panel input,
.login-panel select {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  padding: 10px;
}

.login-panel option {
  color: var(--ink);
}

.signed-in {
  padding: 10px;
  border-radius: 6px;
  background: rgba(15, 118, 110, 0.24);
  color: #d9fffb;
  font-weight: 700;
}

.account-panel {
  display: grid;
  gap: 10px;
}

.ghost-dark-btn {
  min-height: 38px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: transparent;
  color: #e2e8f0;
  padding: 0 12px;
  font-weight: 800;
}

.ghost-dark-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

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

.nav-tab {
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #cbd5e1;
  padding: 12px;
  text-align: left;
  font-weight: 700;
}

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

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

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

.topbar h2 {
  font-size: 32px;
}

.store-context {
  margin: 8px 0 0;
  color: var(--muted);
  font-weight: 700;
}

.topbar-actions,
.form-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.primary-btn,
.ghost-btn,
.danger-btn {
  min-height: 42px;
  border-radius: 6px;
  border: 1px solid transparent;
  padding: 0 14px;
  font-weight: 800;
}

.primary-btn {
  background: var(--primary);
  color: #ffffff;
}

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

.ghost-btn {
  background: var(--paper);
  color: var(--ink);
  border-color: var(--line);
}

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

.view {
  display: none;
}

.active-view {
  display: grid;
  gap: 20px;
}

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

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

.action-card {
  min-height: 112px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--primary);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
  color: var(--ink);
  padding: 16px;
  text-align: left;
}

.action-card:hover,
.action-card:focus-visible {
  border-color: var(--primary);
  outline: 3px solid rgba(33, 95, 154, 0.14);
}

.action-card span {
  display: block;
  margin-bottom: 8px;
  font-size: 18px;
  font-weight: 800;
}

.action-card strong {
  display: block;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.metric,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.metric {
  padding: 18px;
}

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

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 30px;
  line-height: 1;
}

.two-column {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(360px, 0.95fr);
  gap: 20px;
  align-items: start;
}

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

.panel-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

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

.project-list,
.activity-list {
  display: grid;
  gap: 10px;
}

.project-card,
.activity-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfcfe;
}

.project-card-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
}

.project-card h4,
.activity-card h4 {
  margin: 0 0 6px;
  font-size: 16px;
}

.project-card p,
.activity-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.tag {
  border-radius: 999px;
  padding: 5px 9px;
  background: #e8edf5;
  color: #334155;
  font-size: 12px;
  font-weight: 800;
}

.tag.emergency {
  background: #fee2e2;
  color: #991b1b;
}

.tag.high {
  background: #fff7d6;
  color: #854d0e;
}

.tag.done {
  background: #dcfce7;
  color: #166534;
}

.card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.small-btn {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  min-height: 34px;
  padding: 0 10px;
  font-size: 13px;
  font-weight: 800;
}

.primary-small {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

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

.compact-form {
  grid-template-columns: minmax(220px, 1fr) 150px 180px auto;
  align-items: end;
}

.form-grid label {
  display: grid;
  gap: 7px;
  color: #334155;
  font-size: 13px;
  font-weight: 800;
}

.form-grid input,
.form-grid select,
.form-grid textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
  padding: 11px 12px;
}

.form-grid textarea {
  resize: vertical;
}

.report-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 240px));
  gap: 14px;
  margin-bottom: 16px;
}

.report-controls label {
  display: grid;
  gap: 7px;
  color: #334155;
  font-size: 13px;
  font-weight: 800;
}

.report-controls input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
  padding: 11px 12px;
}

.report-summary {
  margin-bottom: 16px;
}

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

.current-punch {
  margin-top: 16px;
}

.user-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfe;
}

.user-row strong {
  display: block;
}

.user-controls {
  display: grid;
  grid-template-columns: 160px 160px 120px auto;
  gap: 8px;
  align-items: center;
  flex: 1;
  max-width: 620px;
}

.user-controls input,
.user-controls select {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
  padding: 7px 9px;
  font-size: 13px;
}

.empty-state {
  display: grid;
  justify-items: center;
  gap: 12px;
  border: 1px dashed #b9c2d0;
  border-radius: 8px;
  padding: 18px;
  color: var(--muted);
  background: #fbfcfe;
  text-align: center;
  font-weight: 700;
}

.empty-state strong {
  color: var(--ink);
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

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

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

th {
  color: #475569;
  font-size: 12px;
  text-transform: uppercase;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  max-width: 340px;
  border-radius: 8px;
  background: #101923;
  color: #ffffff;
  padding: 13px 16px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: 160ms ease;
  font-weight: 700;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

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

  .sidebar {
    position: static;
  }

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

  .nav-tab {
    text-align: center;
  }

  .two-column,
  .metrics-grid,
  .next-actions {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 720px) {
  body {
    background: #ffffff;
  }

  main,
  .sidebar {
    padding: 14px;
  }

  .sidebar {
    gap: 14px;
  }

  .brand-logo {
    width: 82px;
  }

  .brand h1 {
    font-size: 19px;
  }

  .login-panel,
  .login-card,
  .panel,
  .metric {
    box-shadow: none;
  }

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

  .two-column,
  .metrics-grid,
  .next-actions,
  .report-controls,
  .form-grid,
  .compact-form,
  .user-controls,
  .nav-tabs {
    grid-template-columns: 1fr;
  }

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

  .topbar h2 {
    font-size: 26px;
  }

  .topbar {
    margin-bottom: 16px;
  }

  .panel {
    padding: 14px;
  }

  .metric strong {
    font-size: 26px;
  }

  .nav-tab {
    min-height: 44px;
  }

  .topbar-actions,
  .form-actions {
    width: 100%;
  }

  .primary-btn,
  .ghost-btn,
  .danger-btn {
    width: 100%;
  }

  input,
  select,
  textarea {
    font-size: 16px;
  }

  table,
  thead,
  tbody,
  tr,
  th,
  td {
    display: block;
  }

  table {
    min-width: 0;
    border-collapse: separate;
    border-spacing: 0;
  }

  thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  tr {
    border: 1px solid var(--line);
    border-radius: 8px;
    margin-bottom: 12px;
    background: #fbfcfe;
    overflow: hidden;
  }

  td {
    display: grid;
    grid-template-columns: minmax(110px, 0.42fr) minmax(0, 1fr);
    gap: 12px;
    border-bottom: 1px solid var(--line);
    padding: 10px 12px;
  }

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

  td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
  }

  .toast {
    right: 12px;
    bottom: 12px;
    left: 12px;
    max-width: none;
  }
}
