:root {
  color-scheme: light;
  --bg: #f8f9ff;
  --surface: #ffffff;
  --surface-soft: #eff4ff;
  --surface-blue: #e8f1ff;
  --text: #071427;
  --muted: #4d5668;
  --subtle: #768095;
  --line: #d7dce8;
  --line-strong: #c5cad6;
  --primary: #0b5ed7;
  --primary-strong: #0757c7;
  --primary-soft: #dceaff;
  --success: #009a6a;
  --success-soft: #dff8ee;
  --warning: #aa7100;
  --warning-soft: #fff0c9;
  --danger: #cf1d2b;
  --danger-soft: #ffe0e3;
  --info: #1463d9;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.11), 0 10px 25px rgba(15, 23, 42, 0.05);
  --radius: 16px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

body.locked {
  overflow: hidden;
}

body.locked .app-shell {
  display: none;
}

body:not(.locked) .login-screen {
  display: none;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

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

img {
  display: block;
  max-width: 100%;
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background:
    radial-gradient(circle at 50% -10%, rgba(11, 94, 215, 0.14), transparent 34%),
    var(--bg);
}

.login-card {
  display: grid;
  width: min(100%, 420px);
  gap: 18px;
  padding: 24px;
  border: 1px solid rgba(197, 202, 214, 0.86);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.login-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 84px;
}

.login-brand img {
  width: min(220px, 82%);
  max-height: 84px;
  object-fit: contain;
}

.login-copy {
  display: grid;
  gap: 0;
  text-align: center;
}

.login-copy h1 {
  font-size: 30px;
}

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

.field input {
  width: 100%;
  min-height: 48px;
  padding: 0 13px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: white;
  color: var(--text);
  font: inherit;
  font-size: 15px;
  font-weight: 500;
}

.field textarea,
.field select {
  width: 100%;
  min-height: 48px;
  padding: 12px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: white;
  color: var(--text);
  font: inherit;
  font-size: 15px;
  font-weight: 500;
}

.field textarea {
  resize: vertical;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(11, 94, 215, 0.16);
  outline: 0;
}

.login-error {
  min-height: 20px;
  color: var(--danger);
  font-size: 13px;
  font-weight: 700;
}

.login-submit,
.login-help {
  width: 100%;
}

.login-submit {
  position: relative;
}

.login-submit .spinner {
  display: none;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.42);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.login-submit.is-loading .spinner {
  display: inline-block;
}

.btn .spinner {
  display: none;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.42);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.btn.is-loading .spinner {
  display: inline-block;
}

.login-submit:disabled,
.login-help:disabled,
.field input:disabled,
.field textarea:disabled,
.field select:disabled,
.btn:disabled {
  cursor: wait;
  opacity: 0.72;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.app-shell {
  min-height: 100vh;
  padding-bottom: calc(88px + env(safe-area-inset-bottom));
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  height: 64px;
  padding: 0 20px;
  border-bottom: 1px solid rgba(215, 220, 232, 0.75);
  background: rgba(248, 249, 255, 0.92);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  justify-self: start;
  min-height: 44px;
  font-size: 20px;
  font-weight: 800;
}

.brand-mark,
.icon-btn,
.nav-link,
.bottom-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.brand-mark {
  color: var(--primary);
}

.brand-mark svg {
  width: 22px;
  height: 22px;
  stroke-width: 2.8;
}

.icon-btn {
  justify-self: end;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--primary);
  cursor: pointer;
}

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

.icon-btn svg {
  width: 24px;
  height: 24px;
  stroke-width: 2.4;
}

.desktop-nav {
  display: none;
  justify-self: center;
}

.main-view {
  width: min(100%, 1160px);
  margin: 0 auto;
  padding: 24px 16px 32px;
}

.screen-head {
  display: grid;
  gap: 8px;
  margin-bottom: 28px;
}

.screen-head-row {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
}

.eyebrow {
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

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

h1 {
  font-size: clamp(27px, 7vw, 40px);
  line-height: 1.08;
  font-weight: 800;
}

h2 {
  font-size: 24px;
  line-height: 1.16;
  font-weight: 800;
}

h3 {
  font-size: 20px;
  line-height: 1.22;
  font-weight: 800;
}

.screen-head p,
.section-copy,
.card-copy {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.48;
}

.grid {
  display: grid;
  gap: 16px;
}

.dashboard-grid {
  display: grid;
  gap: 16px;
}

.card {
  overflow: hidden;
  border: 1px solid rgba(197, 202, 214, 0.86);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.card-pad {
  padding: 16px;
}

.alert-summary {
  position: relative;
  min-height: 204px;
}

.alert-summary::after {
  position: absolute;
  right: 22px;
  top: 28px;
  color: rgba(11, 94, 215, 0.1);
  content: "!";
  font-size: 132px;
  font-weight: 800;
  line-height: 1;
}

.summary-content {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 14px;
}

.summary-title {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.summary-title span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--danger-soft);
  color: var(--danger);
}

.summary-title svg {
  width: 20px;
  height: 20px;
}

.summary-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border: 0;
  border-radius: 9px;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

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

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

.productivity {
  display: grid;
  min-height: 150px;
  place-items: center;
  padding: 24px;
  border-color: transparent;
  background: linear-gradient(145deg, #2c7be5, #0757d5);
  color: white;
  text-align: center;
}

.productivity svg {
  width: 52px;
  height: 52px;
  margin: 0 auto 8px;
  stroke-width: 2.2;
}

.productivity strong {
  display: block;
  margin-bottom: 5px;
  font-size: 16px;
}

.meter {
  height: 4px;
  margin-top: 22px;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.24);
}

.meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: white;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin: 28px 0 16px;
}

.link-action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  color: var(--primary);
  font-size: 14px;
  font-weight: 600;
}

.project-list {
  display: grid;
  gap: 16px;
}

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

.project-cover {
  width: 100%;
  height: 118px;
  overflow: hidden;
  border-radius: 10px;
  background: var(--surface-soft);
}

.project-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tag-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.topbar .icon-btn + .icon-btn {
  margin-left: -8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
}

.chip.blue {
  background: var(--primary-soft);
  color: var(--primary);
}

.chip.green {
  background: var(--success-soft);
  color: var(--success);
}

.chip.red {
  background: var(--danger-soft);
  color: var(--danger);
}

.chip.amber {
  background: var(--warning-soft);
  color: var(--warning);
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: currentColor;
}

.project-meta {
  display: grid;
  gap: 6px;
}

.progress-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
}

.progress {
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: #dce9ff;
}

.progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
}

.avatars {
  display: flex;
  align-items: center;
  min-height: 28px;
}

.avatar {
  width: 24px;
  height: 24px;
  margin-right: -5px;
  border: 2px solid white;
  border-radius: 50%;
  background: #cad8f5;
}

.avatar.dark {
  background: #47516b;
}

.avatar.green {
  background: #5eeab0;
}

.project-footer {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  padding-top: 4px;
  font-size: 12px;
  color: var(--text);
}

.project-footer strong {
  display: block;
  color: var(--primary);
  font-weight: 700;
  text-align: right;
}

.project-actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding-top: 12px;
}

.mini-action {
  display: grid;
  justify-items: center;
  gap: 6px;
  min-height: 56px;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.mini-action svg {
  width: 24px;
  height: 24px;
  color: var(--primary);
  stroke-width: 2.2;
}

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

.filter-btn {
  min-height: 44px;
  padding: 0 18px;
  border: 0;
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--text);
  font: inherit;
  font-weight: 600;
}

.timeline-divider {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 14px;
  margin: 28px 0;
  color: #737985;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.timeline-divider::before,
.timeline-divider::after {
  height: 1px;
  background: var(--line-strong);
  content: "";
}

.alert-list {
  display: grid;
  gap: 18px;
}

.alert-card {
  position: relative;
  display: grid;
  gap: 14px;
  padding: 20px 18px 16px 22px;
}

.alert-card::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  border-radius: var(--radius) 0 0 var(--radius);
  background: var(--info);
  content: "";
}

.alert-card.critical::before {
  background: var(--danger);
}

.alert-card.warning::before {
  background: #ffae17;
}

.alert-card.info::before {
  background: var(--primary);
}

.alert-top {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.alert-title {
  display: flex;
  align-items: start;
  gap: 12px;
}

.alert-title h3 {
  font-size: 20px;
}

.time {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.alert-message {
  padding: 16px;
  border-radius: 10px;
  background: #edf3ff;
  color: #1b2535;
  font-size: 17px;
  line-height: 1.48;
}

.alert-message strong {
  font-weight: 800;
}

.alert-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--text);
  font-size: 13px;
}

.delivery {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #313849;
}

.resolved {
  color: var(--success);
}

.fab {
  position: fixed;
  right: 24px;
  bottom: calc(98px + env(safe-area-inset-bottom));
  z-index: 30;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border: 0;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  box-shadow: 0 14px 30px rgba(11, 94, 215, 0.3);
  cursor: pointer;
}

.fab svg {
  width: 30px;
  height: 30px;
}

.bottom-nav {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 25;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  min-height: calc(76px + env(safe-area-inset-bottom));
  padding: 8px 18px calc(8px + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(197, 202, 214, 0.65);
  border-radius: 16px 16px 0 0;
  background: rgba(222, 235, 255, 0.95);
  backdrop-filter: blur(16px);
  box-shadow: 0 -10px 24px rgba(15, 23, 42, 0.08);
}

.bottom-link {
  flex-direction: column;
  gap: 4px;
  min-height: 56px;
  border-radius: 999px;
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
}

.bottom-link svg {
  width: 24px;
  height: 24px;
  stroke-width: 2.1;
}

.bottom-link.active {
  background: var(--primary);
  color: white;
}

.empty-state {
  display: grid;
  min-height: 180px;
  place-items: center;
  color: var(--muted);
  text-align: center;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(7, 20, 39, 0.42);
  backdrop-filter: blur(12px);
}

.modal-backdrop[hidden] {
  display: none;
}

.modal-panel {
  width: min(100%, 720px);
  max-height: min(92vh, 820px);
  overflow: auto;
  border: 1px solid rgba(197, 202, 214, 0.86);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 22px 70px rgba(7, 20, 39, 0.28);
}

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

.project-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  padding: 20px;
}

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

.form-status {
  grid-column: 1 / -1;
  min-height: 20px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.form-status.error {
  color: var(--danger);
}

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

.inline-task-entry {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.inline-task-entry .btn {
  min-width: 130px;
}

.project-task-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 38px;
}

.project-task-item {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  max-width: 100%;
  min-height: 36px;
  padding: 7px 8px 7px 14px;
  border: 1px solid #b9d3ff;
  border-radius: 999px;
  background: #eaf2ff;
  color: #0757c7;
  font-size: 14px;
  font-weight: 800;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

.project-task-item span {
  max-width: min(260px, 70vw);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-task-item button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 999px;
  background: rgba(11, 94, 215, 0.08);
  color: #0757c7;
  cursor: pointer;
}

.project-task-item button:hover {
  background: rgba(11, 94, 215, 0.16);
}

.project-task-item button svg {
  width: 18px;
  height: 18px;
}

.tasks-body {
  display: grid;
  gap: 18px;
  padding: 20px;
}

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

.task-row {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
  color: var(--text);
  font-weight: 600;
}

.task-row input {
  width: 20px;
  height: 20px;
  accent-color: var(--primary);
}

.task-row.done span {
  color: var(--muted);
  text-decoration: line-through;
}

.task-form {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 12px;
}

.task-form .btn {
  min-width: 130px;
}

.task-empty {
  padding: 18px;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  color: var(--muted);
  text-align: center;
}

@media (min-width: 760px) {
  .app-shell {
    padding-bottom: 0;
  }

  .topbar {
    height: 72px;
    padding: 0 32px;
  }

  .desktop-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.8);
  }

  .nav-link {
    gap: 8px;
    min-height: 42px;
    padding: 0 14px;
    border-radius: 999px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 700;
  }

  .nav-link svg {
    width: 18px;
    height: 18px;
  }

  .nav-link.active {
    background: var(--primary);
    color: white;
  }

  .bottom-nav {
    display: none;
  }

  .main-view {
    padding: 36px 32px 56px;
  }

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

  .dashboard-grid {
    grid-template-columns: minmax(0, 1.2fr) minmax(300px, 0.8fr);
    align-items: stretch;
  }

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

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

  .alerts-page {
    max-width: 900px;
    margin: 0 auto;
  }

  .fab {
    bottom: 32px;
  }
}

@media (max-width: 379px) {
  .brand {
    font-size: 18px;
  }

  .main-view {
    padding-inline: 12px;
  }

  .alert-message {
    font-size: 16px;
  }
}

@media (max-width: 560px) {
  .inline-task-entry,
  .task-form {
    grid-template-columns: 1fr;
  }
}
