:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --panel: #ffffff;
  --ink: #17202a;
  --muted: #64748b;
  --line: #d8dee8;
  --blue: #1769aa;
  --blue-dark: #0f4d80;
  --green: #1d7f5f;
  --amber: #b56a00;
  --red: #b42318;
  --violet: #6f4aa8;
  --shadow: 0 16px 45px rgba(20, 35, 54, 0.12);
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
}

.splash-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #020202;
  color: #ffffff;
}

.splash-screen.dismissed {
  display: none;
}

.splash-content {
  width: min(980px, 100%);
  display: grid;
  justify-items: center;
  gap: 18px;
  text-align: center;
}

.splash-kicker {
  margin: 0;
  color: #f6c9c4;
  font-size: clamp(1.1rem, 2.4vw, 1.7rem);
  font-weight: 800;
}

.splash-content h1 {
  margin: 0;
  color: #ffffff;
  font-size: clamp(1.6rem, 4vw, 3.4rem);
  line-height: 1.08;
}

.splash-logo {
  width: min(780px, 100%);
  aspect-ratio: 1100 / 520;
  object-fit: contain;
  border: 1px solid #161616;
}

.splash-button {
  border: 1px solid #ff8b84;
  background: #ff6a61;
  color: #111111;
  border-radius: var(--radius);
  min-height: 46px;
  padding: 11px 18px;
  font-weight: 850;
}

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

button {
  cursor: pointer;
}

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

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

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

.brand-logo {
  width: 62px;
  height: 38px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid #3a4d62;
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  background: #f2c94c;
  color: #15202b;
  border-radius: var(--radius);
  font-weight: 800;
}

.brand h1,
.brand p,
.section-heading h2,
.topbar h2,
.topbar p {
  margin: 0;
}

.brand h1 {
  font-size: 1.15rem;
}

.brand p {
  color: #b9c4d0;
  font-size: 0.88rem;
  margin-top: 2px;
}

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

.tab-button {
  border: 1px solid transparent;
  background: transparent;
  color: #d7dee8;
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: var(--radius);
  text-align: left;
}

.tab-button.active,
.tab-button:hover {
  background: #253443;
  color: #ffffff;
  border-color: #3a4d62;
}

.icon {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  font-weight: 800;
}

.people-panel {
  border-top: 1px solid #334455;
  padding-top: 20px;
}

.data-panel {
  border-top: 1px solid #334455;
  padding-top: 20px;
  display: grid;
  gap: 9px;
}

.data-panel p {
  margin: 0;
  color: #b9c4d0;
  font-size: 0.82rem;
  line-height: 1.35;
}

.side-button {
  border: 1px solid #3a4d62;
  background: #253443;
  color: #ffffff;
  min-height: 38px;
  border-radius: var(--radius);
  padding: 8px 10px;
  font-weight: 760;
  text-align: center;
}

.side-button:hover {
  background: #314457;
}

.section-heading,
.topbar,
.board-toolbar,
.card-meta,
.card-actions,
.modal-form header,
.modal-form footer,
.todo-row-header {
  display: flex;
  align-items: center;
}

.section-heading,
.topbar,
.board-toolbar,
.modal-form header,
.modal-form footer,
.todo-row-header {
  justify-content: space-between;
  gap: 14px;
}

.section-heading h2 {
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0;
  color: #b9c4d0;
}

.icon-button,
.ghost-button {
  border: 0;
  background: rgba(255, 255, 255, 0.12);
  color: inherit;
  min-width: 34px;
  height: 34px;
  border-radius: 7px;
}

.people-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.person-item {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 9px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.08);
}

.avatar {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: #e7f0f7;
  color: #17202a;
  font-weight: 800;
}

.person-item strong {
  display: block;
  font-size: 0.92rem;
}

.person-item span {
  display: block;
  color: #b9c4d0;
  font-size: 0.8rem;
}

.workspace {
  padding: 28px;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  margin-bottom: 20px;
}

.eyebrow {
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  font-weight: 800;
  letter-spacing: 0;
}

.topbar h2 {
  font-size: clamp(1.6rem, 2.5vw, 2.3rem);
  margin-top: 2px;
}

.top-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.primary-button,
.secondary-button,
.danger-button {
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 10px 14px;
  min-height: 42px;
  font-weight: 750;
}

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

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

.secondary-button {
  color: var(--ink);
  background: #ffffff;
  border-color: var(--line);
}

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

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.summary-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
}

.summary-card span {
  color: var(--muted);
  font-size: 0.83rem;
  font-weight: 700;
}

.summary-card strong {
  display: block;
  font-size: 1.8rem;
  margin-top: 4px;
}

.content-panel {
  display: none;
}

.content-panel.active {
  display: block;
}

.app-credit {
  margin-top: auto;
  padding-top: 28px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 750;
  text-align: center;
}

.board-toolbar {
  margin-bottom: 14px;
  flex-wrap: wrap;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 750;
}

input,
select,
textarea {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--ink);
  min-height: 42px;
  padding: 9px 10px;
}

textarea {
  resize: vertical;
}

.task-columns {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 14px;
  align-items: start;
}

.column {
  min-height: 360px;
  background: #e9edf2;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
}

.column h3 {
  margin: 0 0 10px;
  font-size: 0.92rem;
  color: #39485a;
}

.task-card,
.todo-row {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: 0 2px 10px rgba(20, 35, 54, 0.05);
}

.task-card + .task-card,
.todo-row + .todo-row {
  margin-top: 10px;
}

.task-card h4,
.todo-row h3 {
  margin: 0;
  font-size: 1rem;
}

.description {
  color: #4b5d72;
  margin: 8px 0 0;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.card-meta {
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 12px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #eef3f7;
  color: #405165;
  font-size: 0.78rem;
  font-weight: 760;
}

.pill.open {
  background: #fff2d6;
  color: var(--amber);
}

.pill.done {
  background: #e9ddf8;
  color: var(--violet);
}

.pill.approved,
.pill.complete {
  background: #dcf4ea;
  color: var(--green);
}

.pill.overdue {
  background: #fee4e2;
  color: var(--red);
}

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

.small-button {
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
  min-height: 34px;
  padding: 7px 9px;
  border-radius: 7px;
  font-weight: 740;
}

.small-button.positive {
  background: var(--green);
  color: #ffffff;
  border-color: var(--green);
}

.small-button.warning {
  background: var(--violet);
  color: #ffffff;
  border-color: var(--violet);
}

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

.todo-row {
  display: grid;
  gap: 10px;
}

.todo-row.overdue {
  border-left: 5px solid var(--red);
}

.empty-state {
  background: var(--panel);
  border: 1px dashed #adb8c6;
  border-radius: var(--radius);
  padding: 28px;
  text-align: center;
  color: var(--muted);
}

dialog {
  border: 0;
  border-radius: var(--radius);
  padding: 0;
  width: min(560px, calc(100vw - 28px));
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(8, 15, 24, 0.42);
}

.modal-form {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.modal-form h2 {
  margin: 0;
}

.modal-form .ghost-button {
  color: var(--ink);
  background: #eef3f7;
  font-size: 1.2rem;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.footer-spacer {
  flex: 1;
}

.toast-zone {
  position: fixed;
  right: 18px;
  bottom: 18px;
  display: grid;
  gap: 10px;
  z-index: 10;
  width: min(390px, calc(100vw - 36px));
}

.toast {
  background: #17202a;
  color: #ffffff;
  border: 1px solid #34465b;
  border-left: 5px solid #f2c94c;
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: var(--shadow);
}

.toast strong {
  display: block;
}

.toast p {
  margin: 4px 0 0;
  color: #d7dee8;
}

.hidden {
  display: none !important;
}

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

  .sidebar {
    min-height: auto;
  }

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

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

  .top-actions,
  .top-actions button {
    width: 100%;
  }
}

@media (max-width: 620px) {
  .workspace,
  .sidebar {
    padding: 18px;
  }

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

  .board-toolbar label {
    width: 100%;
  }
}

/* =====================================================================
   Auth / onboarding — added for multi-user login and department setup.
   Reuses existing tokens (--blue, --green, --line, --panel, --shadow)
   so it stays consistent with the rest of the app.
   ===================================================================== */

.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #020202;
}

.auth-card {
  width: min(460px, 100%);
  background: var(--panel);
  border-radius: var(--radius);
  padding: 30px;
  box-shadow: var(--shadow);
}

.auth-card .splash-kicker {
  color: var(--blue-dark);
  font-size: 0.95rem;
  margin: 0 0 6px;
}

.auth-card h1 {
  margin: 0 0 6px;
  font-size: 1.5rem;
  color: var(--ink);
}

.auth-subtitle {
  color: var(--muted);
  font-size: 0.88rem;
  margin: 0 0 18px;
}

.auth-form,
.onboarding-columns form {
  display: grid;
  gap: 12px;
}

.auth-message {
  min-height: 1.3em;
  font-size: 0.85rem;
  color: var(--green);
  margin: 10px 0 0;
}

.auth-message.error-text {
  color: var(--red);
}

.ghost-link {
  display: block;
  width: 100%;
  text-align: center;
  background: none;
  border: 0;
  color: var(--blue);
  text-decoration: underline;
  font-size: 0.85rem;
  margin-top: 10px;
  padding: 6px 0;
  cursor: pointer;
}

.onboarding-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-top: 8px;
}

.onboarding-columns h2 {
  font-size: 0.92rem;
  margin: 0 0 4px;
  color: var(--ink);
}

.onboarding-department-list {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.onboarding-subheading {
  color: var(--muted);
  font-size: 0.82rem;
  margin: 0 0 4px;
  font-weight: 750;
}

@media (max-width: 640px) {
  .onboarding-columns {
    grid-template-columns: 1fr;
  }
}

/* Member / invite dialogs */
.checkbox-field {
  display: flex !important;
  flex-direction: row;
  align-items: center;
  gap: 8px !important;
}

.invite-code {
  font-family: ui-monospace, SFMono-Regular, "IBM Plex Mono", monospace;
  font-size: 1.4rem;
  letter-spacing: 0.12em;
  text-align: center;
  background: #eef3f7;
  border-radius: var(--radius);
  padding: 14px;
  margin: 6px 0;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, "IBM Plex Mono", monospace;
}

/* "Powered by" credit footer, shown at the bottom of every screen */
.credit-logo {
  height: 16px;
  width: auto;
  vertical-align: middle;
  margin-left: 5px;
  opacity: 0.92;
}

.splash-credit {
  margin-top: 18px;
  padding-top: 0;
  color: #f6c9c4;
}

/* =====================================================================
   VISUAL REFRESH — depth, hover states, and hierarchy so this reads as
   an application rather than a flat document. Reuses all existing
   tokens; nothing here changes the brand colors.
   ===================================================================== */

body {
  background:
    radial-gradient(circle at 12% -10%, rgba(23, 105, 170, 0.10), transparent 45%),
    radial-gradient(circle at 100% 0%, rgba(111, 74, 168, 0.08), transparent 40%),
    var(--bg);
}

/* Buttons: give every action a bit of lift and a real hover/active state */
.primary-button,
.secondary-button,
.danger-button,
.side-button,
.small-button,
.splash-button {
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease, border-color 0.12s ease;
  cursor: pointer;
}

.primary-button {
  box-shadow: 0 6px 16px rgba(23, 105, 170, 0.28);
}

.primary-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(23, 105, 170, 0.34);
}

.primary-button:active,
.secondary-button:active,
.small-button:active,
.side-button:active {
  transform: translateY(0);
}

.secondary-button:hover {
  border-color: var(--blue);
  color: var(--blue-dark);
}

.small-button:hover {
  border-color: var(--blue);
  transform: translateY(-1px);
}

.small-button.positive:hover,
.small-button.warning:hover {
  filter: brightness(1.08);
}

/* Sidebar polish */
.sidebar {
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.04);
}

.tab-button {
  transition: background 0.12s ease, transform 0.1s ease;
}

.tab-button:hover {
  transform: translateX(2px);
}

.person-item {
  transition: background 0.12s ease;
}

.person-item:hover {
  background: rgba(255, 255, 255, 0.14);
}

/* Summary tiles: a colored top edge per metric instead of four flat white boxes */
.summary-card {
  position: relative;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(20, 35, 54, 0.05);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.summary-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(20, 35, 54, 0.1);
}

.summary-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--blue);
}

.summary-card:nth-child(2)::before {
  background: var(--amber);
}

.summary-card:nth-child(3)::before {
  background: var(--green);
}

.summary-card:nth-child(4)::before {
  background: var(--red);
}

/* Task tickets / to-do rows: real elevation and a hover lift */
.task-card,
.todo-row {
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.task-card:hover,
.todo-row:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 26px rgba(20, 35, 54, 0.1);
}

.column {
  background: linear-gradient(180deg, #eef1f5, #e9edf2 40%);
}

/* Dialogs: a touch more presence */
dialog {
  animation: cns-pop 0.15s ease;
}

@keyframes cns-pop {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* Step hints + setup / welcome copy */
.step-hint {
  margin: 0 0 8px;
  color: var(--blue);
  font-weight: 800;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.setup-steps {
  margin: 0 0 16px;
  padding-left: 20px;
  color: var(--ink);
  font-size: 0.92rem;
  line-height: 1.7;
}

.setup-steps li {
  margin-bottom: 4px;
}

.setup-steps code {
  background: #eef3f7;
  border-radius: 5px;
  padding: 1px 6px;
  font-size: 0.85em;
}

.welcome-steps li strong {
  color: var(--blue-dark);
}

/* First-time tip banner inside the app */
.tip-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: linear-gradient(90deg, #e7f0f7, #f3ecfb);
  border: 1px solid var(--line);
  border-left: 4px solid var(--blue);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 18px;
}

.tip-banner p {
  margin: 0;
  font-size: 0.88rem;
  color: var(--ink);
}

.tip-banner button {
  background: none;
  border: 0;
  font-size: 1.1rem;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
}

/* Empty states: less "blank page", more "nothing here yet" */
.empty-state {
  background: repeating-linear-gradient(135deg, #f4f6f8, #f4f6f8 10px, #eef1f5 10px, #eef1f5 20px);
}
