:root {
  color-scheme: dark;
  --bg: #080b0d;
  --surface: #101518;
  --surface-2: #151b1f;
  --surface-3: #1b2328;
  --border: rgba(255, 255, 255, 0.12);
  --text: #f3f7f5;
  --muted: #9aa7a4;
  --accent: #d8b96c;
  --accent-2: #62c3b2;
  --danger: #ff8c8c;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.32);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

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

button, input, select { font: inherit; }

button { cursor: pointer; }

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

h1 {
  margin-bottom: 0;
  font-size: clamp(30px, 4vw, 48px);
  line-height: 1.08;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 8px;
  font-size: 18px;
}

p {
  color: var(--muted);
  line-height: 1.7;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.auth-shell {
  position: relative;
  display: grid;
  grid-template-columns: minmax(360px, 0.95fr) minmax(420px, 560px);
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  gap: clamp(36px, 6vw, 92px);
  overflow: hidden;
  padding: max(28px, env(safe-area-inset-top)) clamp(24px, 5vw, 72px) 28px;
  background:
    radial-gradient(circle at 18% 28%, rgba(42, 148, 156, 0.22), transparent 28rem),
    radial-gradient(circle at 80% 38%, rgba(44, 58, 98, 0.26), transparent 30rem),
    linear-gradient(145deg, #05090d, #071216 52%, #050811);
}

.auth-shell::before {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.026) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.026) 1px, transparent 1px);
  background-size: 88px 88px;
  content: "";
  mask-image: radial-gradient(circle at 50% 38%, black, transparent 72%);
}

.auth-shell > * {
  position: relative;
  z-index: 1;
}

.auth-brand {
  display: grid;
  justify-items: start;
  gap: 22px;
  max-width: 620px;
  text-align: left;
}

.brand-mark {
  display: grid;
  width: 64px;
  height: 64px;
  place-items: center;
  border: 1px solid rgba(62, 206, 222, 0.55);
  border-radius: 22px;
  background: linear-gradient(145deg, rgba(47, 132, 146, 0.34), rgba(24, 48, 60, 0.34));
  color: #a4f4fb;
  font-size: 21px;
  font-weight: 800;
  letter-spacing: 0.04em;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 22px 60px rgba(45, 203, 218, 0.1);
}

.auth-brand h1 {
  max-width: 620px;
  font-size: clamp(34px, 4.2vw, 58px);
  font-weight: 800;
  line-height: 1.02;
  letter-spacing: 0;
}

.auth-brand p {
  max-width: 520px;
  margin-bottom: 8px;
  color: #8d9aaf;
  font-size: clamp(15px, 1.6vw, 20px);
  line-height: 1.4;
}

.brand-points {
  display: flex;
  max-width: 560px;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 0;
}

.brand-points span {
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.045);
  color: #7f8da3;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 12px;
}

.auth-panel,
.modules-panel,
.module-workbench,
.tasks-panel,
.metrics article,
.panel {
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.auth-panel {
  width: min(520px, 100%);
  border-color: rgba(148, 163, 184, 0.24);
  border-radius: 30px;
  padding: clamp(24px, 3.2vw, 38px);
  background:
    linear-gradient(145deg, rgba(21, 31, 39, 0.94), rgba(15, 23, 31, 0.88)),
    rgba(18, 27, 35, 0.9);
  backdrop-filter: blur(26px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 32px 96px rgba(0, 0, 0, 0.38);
}

.auth-provider {
  display: grid;
  justify-items: center;
  gap: 8px;
  margin-bottom: 22px;
}

.auth-provider h2 {
  margin-bottom: 0;
  color: #eef5f5;
  font-size: clamp(20px, 2vw, 26px);
  font-weight: 800;
  line-height: 1.25;
}

.auth-provider p {
  margin-bottom: 0;
  color: #8190a5;
  font-size: 15px;
  text-align: center;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}

.tab-button,
.icon-button,
.google-button,
.email-login-button,
.record-form button,
.task-form button {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text);
  padding: 11px 14px;
}

.tab-button.is-active,
.record-form button,
.task-form button {
  border-color: rgba(216, 185, 108, 0.55);
  background: rgba(216, 185, 108, 0.14);
  color: #ffe8aa;
}

.google-button {
  display: flex;
  width: 100%;
  min-height: 56px;
  align-items: center;
  justify-content: center;
  gap: 14px;
  border-color: rgba(208, 219, 231, 0.32);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(248, 251, 252, 0.98), rgba(225, 232, 236, 0.96));
  color: #f7faf9;
  color: #142027;
  font-size: 16px;
  font-weight: 800;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.86),
    0 16px 34px rgba(0, 0, 0, 0.18);
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.google-button:hover {
  border-color: rgba(231, 241, 244, 0.72);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 20px 44px rgba(0, 0, 0, 0.24);
  transform: translateY(-1px);
}

.google-mark {
  color: #4285f4;
  font-size: 24px;
  font-weight: 900;
}

.google-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.auth-divider {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 22px;
  align-items: center;
  margin: 20px 0;
  color: #66758a;
  font-size: 14px;
  font-weight: 700;
}

.auth-divider::before,
.auth-divider::after {
  height: 1px;
  background: rgba(133, 148, 168, 0.22);
  content: "";
}

.email-login-button {
  width: 100%;
  min-height: 54px;
  border-color: rgba(111, 126, 145, 0.22);
  border-radius: 17px;
  background: rgba(7, 12, 18, 0.42);
  color: #94a2b5;
  font-size: 17px;
  font-weight: 800;
  transition: border-color 160ms ease, color 160ms ease, background 160ms ease;
}

.email-login-button:hover {
  border-color: rgba(132, 151, 172, 0.36);
  background: rgba(12, 19, 27, 0.64);
  color: #c1cad8;
}

.auth-policy {
  margin: 20px 0 14px;
  text-align: center;
  color: #5f6d82;
  font-size: 13px;
  line-height: 1.8;
}

.auth-policy a,
.auth-register button {
  border: 0;
  background: transparent;
  color: #20d7e8;
  font-weight: 800;
  text-decoration: none;
}

.auth-policy a {
  color: #738198;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.auth-text-button {
  display: block;
  margin: 0 auto;
  border: 0;
  background: transparent;
  color: #67768d;
  font-size: 14px;
  font-weight: 700;
}

.auth-register {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: #7f8da3;
  font-size: 16px;
  font-weight: 600;
  margin-top: -4px;
}

.auth-register button {
  padding: 0;
  font-size: 16px;
}

.auth-footer {
  color: #4e5a70;
  font-size: 13px;
  grid-column: 1 / -1;
  justify-self: center;
  margin-top: -8px;
}

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

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

input,
select {
  min-width: 0;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #0b0f12;
  color: var(--text);
  padding: 11px 12px;
  outline: none;
}

input:focus,
select:focus {
  border-color: rgba(98, 195, 178, 0.72);
  box-shadow: 0 0 0 3px rgba(98, 195, 178, 0.12);
}

.form-message {
  min-height: 22px;
  margin: 12px 0 0;
  color: var(--danger);
  font-size: 13px;
}

.form-message[data-type="success"] { color: var(--accent-2); }

.app-shell {
  width: min(1280px, 100%);
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 18px 28px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0 18px;
  border-bottom: 1px solid var(--border);
}

.topbar-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.session-line {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 14px;
}

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

.metrics article {
  border-radius: 12px;
  padding: 16px;
}

.metrics span {
  display: block;
  color: var(--muted);
  font-size: 14px;
}

.metrics strong {
  display: block;
  margin-top: 10px;
  font-size: 34px;
  color: var(--accent-2);
}

.workspace {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr) 300px;
  gap: 14px;
  align-items: start;
}

.modules-panel,
.module-workbench,
.tasks-panel {
  border-radius: 14px;
  padding: 16px;
}

.section-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  align-items: flex-start;
}

.section-title span {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.module-heading > div {
  display: flex;
  gap: 10px;
  align-items: baseline;
}

#activeModuleIndex {
  color: var(--accent);
  font-weight: 800;
}

.modules-grid {
  display: grid;
  gap: 8px;
}

.module-card {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  gap: 8px 10px;
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text);
  padding: 12px;
  text-align: left;
}

.module-card small {
  color: var(--accent);
  font-weight: 800;
}

.module-card strong {
  font-size: 14px;
}

.module-card span {
  grid-column: 2 / 4;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.module-card em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.module-card.is-active {
  border-color: rgba(98, 195, 178, 0.58);
  background: rgba(98, 195, 178, 0.1);
}

.record-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 12px;
  background: var(--surface-2);
}

.record-form button {
  align-self: end;
}

.record-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.record-card,
.task,
.empty-state {
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 10px;
  background: var(--surface-2);
  padding: 12px;
}

.record-card {
  display: grid;
  gap: 10px;
}

.record-card > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.record-card small {
  color: var(--muted);
  white-space: nowrap;
}

.record-card p {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
}

.record-card span {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  padding: 5px 8px;
  color: var(--muted);
  font-size: 12px;
}

.record-card b {
  color: var(--text);
  font-weight: 600;
}

.text-button {
  width: fit-content;
  border: 0;
  background: transparent;
  color: var(--danger);
  padding: 0;
  font-size: 13px;
}

.empty-state {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.task-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-bottom: 12px;
}

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

.task strong {
  display: block;
  margin-bottom: 6px;
}

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

.offline {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 18px;
}

.legal-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 22px;
  background: linear-gradient(145deg, #061014, #080d16 58%, #05070d);
}

.panel {
  width: min(420px, 100%);
  border-radius: 14px;
  padding: 24px;
}

.legal-panel {
  width: min(680px, 100%);
}

.button {
  display: inline-flex;
  border: 1px solid rgba(216, 185, 108, 0.55);
  border-radius: 10px;
  background: rgba(216, 185, 108, 0.14);
  color: #ffe8aa;
  padding: 11px 14px;
  text-decoration: none;
}

@media (max-width: 1080px) {
  .workspace {
    grid-template-columns: 260px minmax(0, 1fr);
  }

  .tasks-panel {
    grid-column: 1 / 3;
  }
}

@media (min-width: 721px) and (max-height: 820px) {
  .auth-shell {
    gap: 42px;
    padding-top: max(20px, env(safe-area-inset-top));
    padding-bottom: 18px;
  }

  .auth-brand {
    gap: 14px;
  }

  .auth-brand h1 {
    font-size: clamp(32px, 4vw, 50px);
  }

  .auth-brand p {
    margin-bottom: 0;
    font-size: 15px;
  }

  .brand-points span {
    padding: 6px 10px;
    font-size: 12px;
  }

  .auth-panel {
    padding: 24px 30px;
  }

  .auth-provider {
    margin-bottom: 18px;
  }

  .auth-provider p {
    display: none;
  }

  .auth-divider {
    margin: 16px 0;
  }

  .auth-policy {
    margin: 16px 0 10px;
  }
}

@media (max-width: 720px) {
  .metrics,
  .workspace,
  .record-form {
    grid-template-columns: 1fr;
  }

  .auth-shell {
    grid-template-columns: 1fr;
    justify-content: start;
    gap: 20px;
    padding: max(34px, env(safe-area-inset-top)) 16px 28px;
  }

  .auth-brand {
    justify-items: center;
    text-align: center;
  }

  .auth-brand h1 {
    font-size: 34px;
  }

  .auth-brand p,
  .auth-footer {
    font-size: 15px;
  }

  .auth-panel {
    border-radius: 22px;
    padding: 34px 22px 30px;
  }

  .google-button,
  .email-login-button {
    min-height: 60px;
    border-radius: 16px;
    font-size: 17px;
  }

  .auth-divider {
    gap: 14px;
    margin: 26px 0;
    font-size: 15px;
  }

  .topbar,
  .record-card > div {
    display: grid;
  }

  .tasks-panel {
    grid-column: auto;
  }

  .section-title {
    display: grid;
  }

  .module-card {
    grid-template-columns: 34px 1fr auto;
  }

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