:root {
  --navy: #1e2f46;
  --navy-2: #2a405d;
  --red: #d52f39;
  --red-dark: #b5222c;
  --bg: #f3f6f9;
  --card: #fff;
  --text: #172435;
  --muted: #68778a;
  --line: #dfe6ed;
  --success: #20845a;
  --warning: #b86810;
  --shadow: 0 12px 34px rgba(30, 47, 70, .11);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
}

* { box-sizing: border-box; }
html { width: 100%; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { width: 100%; margin: 0; min-height: 100vh; overflow-x: hidden; background: var(--bg); }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.login-screen { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: linear-gradient(145deg, var(--navy), #0f1c2c); }
.login-card { width: min(100%, 410px); padding: 34px; border-radius: 24px; background: var(--card); box-shadow: 0 26px 70px rgba(0,0,0,.28); }
.login-card img { display: block; border-radius: 18px; margin-bottom: 18px; }
h1, h2, h3, p { margin-top: 0; }
.login-card h1 { margin-bottom: 8px; font-size: 32px; }
.eyebrow { margin-bottom: 5px; color: var(--red); font-weight: 800; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; }
.muted { color: var(--muted); }
form { display: grid; gap: 16px; }
label { display: grid; gap: 7px; color: var(--navy); font-size: 13px; font-weight: 700; }
input, textarea, select { width: 100%; border: 1px solid var(--line); border-radius: 11px; background: #fff; color: var(--text); padding: 12px 13px; outline: none; font-size: 16px; }
input:focus, textarea:focus, select:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(213,47,57,.12); }
.form-error { min-height: 20px; margin: -4px 0; color: var(--red); font-size: 13px; font-weight: 700; }

.button { min-height: 44px; border: 0; border-radius: 11px; padding: 10px 15px; font-weight: 800; transition: .18s ease; }
.button:hover { transform: translateY(-1px); }
.button:disabled { cursor: wait; opacity: .6; transform: none; }
.button--primary { background: var(--red); color: #fff; }
.button--primary:hover { background: var(--red-dark); }
.button--navy { background: var(--navy); color: #fff; }
.button--quiet { background: #edf1f5; color: var(--navy); }
.button--danger { background: #fff0f1; color: var(--red-dark); }
.button--wide { width: 100%; }
.icon-button { width: 42px; height: 42px; border: 0; border-radius: 50%; background: #eef2f6; color: var(--navy); font-size: 24px; }

.app-shell { min-height: 100vh; }
.sidebar { display: none; }
.app-content { min-width: 0; padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between; padding: 15px 17px; background: rgba(243,246,249,.94); backdrop-filter: blur(13px); border-bottom: 1px solid rgba(223,230,237,.8); }
.topbar h1 { margin: 0; font-size: 24px; }
.topbar .eyebrow { margin-bottom: 2px; }
main { padding: 16px; max-width: 1280px; margin: 0 auto; }

.page-actions { display: flex; justify-content: flex-end; margin-bottom: 14px; }
.stats { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 11px; margin-bottom: 18px; }
.stat { border: 0; border-radius: 16px; background: var(--card); padding: 16px; text-align: left; box-shadow: 0 4px 18px rgba(30,47,70,.06); }
.stat span { display: block; margin-bottom: 7px; color: var(--muted); font-size: 12px; font-weight: 800; }
.stat strong { font-size: 27px; color: var(--navy); }
.section-heading { display: flex; align-items: center; justify-content: space-between; margin: 20px 0 12px; }
.section-heading h2 { margin: 0; font-size: 18px; }

.task-grid { display: grid; gap: 12px; }
.task-card { border-radius: 17px; padding: 16px; background: var(--card); border: 1px solid var(--line); box-shadow: 0 5px 20px rgba(30,47,70,.055); }
.task-card__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.task-card h3 { margin-bottom: 7px; font-size: 17px; }
.task-description { color: var(--muted); font-size: 14px; line-height: 1.5; white-space: pre-line; }
.task-meta { display: grid; gap: 7px; margin: 14px 0; color: #4c5d70; font-size: 12px; }
.task-meta span { display: flex; justify-content: space-between; gap: 10px; }
.task-meta strong { color: var(--navy); text-align: right; }
.badge { flex: 0 0 auto; display: inline-flex; align-items: center; min-height: 26px; border-radius: 999px; padding: 4px 9px; font-size: 10px; font-weight: 900; text-transform: uppercase; }
.badge--pending { background: #fff4d8; color: #8d5b00; }
.badge--completed { background: #dff6ea; color: #176d49; }
.badge--overdue { background: #ffe2e4; color: #a51f29; }
.extension-box { margin: 12px 0; border-left: 4px solid var(--red); border-radius: 8px; padding: 10px 12px; background: #fff3f4; font-size: 13px; }
.task-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.task-actions .button { flex: 1 1 auto; min-height: 40px; padding: 8px 11px; font-size: 12px; }
.empty { padding: 34px 20px; border: 1px dashed #cbd5df; border-radius: 16px; background: rgba(255,255,255,.55); color: var(--muted); text-align: center; }

.filters { display: grid; gap: 10px; margin-bottom: 13px; border-radius: 15px; padding: 12px; background: var(--card); border: 1px solid var(--line); }
.table-wrap { overflow-x: auto; border-radius: 16px; background: var(--card); border: 1px solid var(--line); }
.task-table { width: 100%; border-collapse: collapse; min-width: 900px; }
.task-table th, .task-table td { padding: 13px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; font-size: 13px; }
.task-table th { background: #f7f9fb; color: var(--muted); font-size: 11px; text-transform: uppercase; }
.task-table tr:last-child td { border-bottom: 0; }
.task-table .task-actions { min-width: 210px; }

.bottom-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: flex; align-items: stretch; gap: 2px; overflow-x: auto; padding: 7px 7px calc(7px + env(safe-area-inset-bottom)); background: #fff; border-top: 1px solid var(--line); box-shadow: 0 -8px 28px rgba(30,47,70,.09); }
.nav-item { flex: 1 0 67px; min-height: 53px; border: 0; border-radius: 11px; background: transparent; color: var(--muted); font-size: 10px; font-weight: 800; }
.nav-item span { display: block; margin-bottom: 3px; font-size: 20px; }
.nav-item.is-active { background: #edf1f5; color: var(--red); }
.nav-item--new { background: var(--red); color: #fff; }

.modal { position: fixed; inset: 0; z-index: 100; display: grid; align-items: end; }
.modal__backdrop { position: absolute; inset: 0; border: 0; background: rgba(11,21,34,.6); backdrop-filter: blur(3px); }
.modal__panel { position: relative; z-index: 1; width: 100%; max-height: 90vh; overflow-y: auto; border-radius: 22px 22px 0 0; padding: 20px 18px calc(22px + env(safe-area-inset-bottom)); background: #fff; }
.modal__panel header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.modal__panel h2 { margin: 0; }
.toast { position: fixed; left: 50%; bottom: 92px; z-index: 150; max-width: calc(100% - 32px); transform: translate(-50%, 20px); border-radius: 11px; padding: 11px 15px; background: var(--navy); color: #fff; opacity: 0; pointer-events: none; transition: .2s; box-shadow: var(--shadow); font-size: 13px; }
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.toast.is-error { background: var(--red-dark); }

@media (min-width: 760px) {
  .stats { grid-template-columns: repeat(4, minmax(0,1fr)); }
  .task-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .filters { grid-template-columns: 2fr 1fr 1fr; }
  .modal { align-items: center; justify-items: center; padding: 24px; }
  .modal__panel { max-width: 560px; border-radius: 22px; padding: 24px; }
}

@media (min-width: 1024px) {
  .app-shell { display: grid; grid-template-columns: 250px minmax(0,1fr); }
  .sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 24px 16px; background: var(--navy); color: #fff; }
  .brand { display: flex; align-items: center; gap: 11px; padding: 0 8px 24px; }
  .brand img { border-radius: 11px; object-fit: contain; background: #fff; }
  .brand strong, .brand span { display: block; }
  .brand span { margin-top: 2px; color: #b9c5d3; font-size: 12px; }
  .side-nav { display: grid; gap: 5px; }
  .side-nav .nav-item { min-height: 46px; display: flex; align-items: center; gap: 11px; padding: 0 13px; color: #c9d3de; text-align: left; font-size: 13px; }
  .side-nav .nav-item span { margin: 0; font-size: 17px; }
  .side-nav .nav-item.is-active { background: var(--navy-2); color: #fff; }
  .side-nav .nav-item--new { margin-top: 9px; background: var(--red); color: #fff; }
  .logout-button { margin-top: auto; }
  .bottom-nav { display: none; }
  .app-content { padding-bottom: 0; }
  .topbar { padding: 20px 28px; }
  main { padding: 25px 28px 42px; }
  .task-grid { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .toast { bottom: 28px; }
}
