:root {
  --ink: #15171A;
  --muted: #64748b;
  --line: #e2e8f0;
  --surface: #ffffff;
  --surface-alt: #f8fafc;
  --accent: #2454CC;
  --accent-strong: #1a3fa8;
  --accent-soft: #eaf0ff;
  --amber: #f59e0b;
  --rose: #ef4444;
  --green: #16a34a;
  --sidebar: #15171A;
  --radius: 16px;
  --radius-sm: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  font-family: 'Plus Jakarta Sans', Inter, ui-sans-serif, system-ui, -apple-system, sans-serif;
  background: var(--surface-alt);
  color: var(--ink);
}

button, input { font: inherit; }

.al-hidden { display: none !important; }

/* ---------- Auth screens ---------- */

.al-auth {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(160deg, #eef4ff 0%, #f8fafc 60%);
}

.al-auth-card {
  width: min(400px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 34px 30px;
  box-shadow: 0 22px 60px rgba(20, 32, 50, 0.1);
  display: grid;
  gap: 16px;
}

.al-auth-logo { display: flex; justify-content: center; margin-bottom: 4px; }
.al-auth-logo img { height: 34px; width: auto; }

.al-auth-card h1 {
  font-family: 'Unbounded', sans-serif;
  font-weight: 800;
  font-size: 1.3rem;
  margin: 0;
  text-align: center;
  color: var(--ink);
}

.al-auth-card p.al-auth-sub {
  margin: -8px 0 4px;
  text-align: center;
  color: var(--muted);
  font-size: 0.88rem;
}

.al-field { display: grid; gap: 6px; font-size: 0.86rem; font-weight: 600; color: var(--ink); }
.al-field input {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  font-size: 0.94rem;
  font-weight: 500;
  color: var(--ink);
  background: var(--surface-alt);
}
.al-field input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.al-btn-primary {
  border: none;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 0.94rem;
  padding: 12px 16px;
  cursor: pointer;
  box-shadow: 0 12px 24px rgba(36, 84, 204, 0.25);
}
.al-btn-primary:hover { background: var(--accent-strong); }
.al-btn-primary:disabled { opacity: 0.6; cursor: default; }

.al-feedback {
  min-height: 18px;
  font-size: 0.82rem;
  color: var(--rose);
  text-align: center;
}

.al-auth-powered {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
}
.al-auth-powered span {
  font-size: 0.6rem;
  color: #9aa1ab;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
}
.al-auth-powered img { height: 18px; width: auto; }

/* ---------- App shell ---------- */

.al-shell {
  display: grid;
  grid-template-columns: 232px 1fr;
  min-height: 100vh;
}

.al-sidebar {
  background: var(--sidebar);
  color: #fff;
  display: flex;
  flex-direction: column;
  padding: 22px 16px;
  gap: 6px;
}

.al-sidebar-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px 22px;
  font-family: 'Unbounded', sans-serif;
  font-weight: 800;
  font-size: 1.05rem;
}
.al-sidebar-logo img { height: 26px; width: auto; }

.al-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 12px;
  color: rgba(255,255,255,0.72);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  background: transparent;
  text-align: left;
  width: 100%;
}
.al-nav-item:hover { background: rgba(255,255,255,0.06); color: #fff; }
.al-nav-item.active { background: var(--accent); color: #fff; }
.al-nav-item svg { flex: 0 0 auto; }

.al-sidebar-footer {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid rgba(255,255,255,0.12);
}

.al-main {
  padding: 26px 34px 90px;
  max-width: 980px;
  width: 100%;
}

.al-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}
.al-topbar h2 { margin: 0 0 2px; font-size: 1.5rem; font-family: 'Unbounded', sans-serif; font-weight: 800; }
.al-topbar p { margin: 0; color: var(--muted); font-size: 0.9rem; }

.al-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent-strong);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 0.9rem;
}

.al-view { display: none; }
.al-view.active { display: block; }

.al-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}

.al-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  display: grid;
  gap: 10px;
}

.al-card-icon {
  width: 38px; height: 38px; border-radius: 10px;
  background: var(--accent-soft); color: var(--accent-strong);
  display: flex; align-items: center; justify-content: center;
}

.al-card h3 { margin: 0; font-size: 0.86rem; color: var(--muted); font-weight: 600; }
.al-card strong { font-size: 1.05rem; }
.al-card span { color: var(--muted); font-size: 0.84rem; }

.al-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 18px;
}
.al-panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.al-panel-head h3 { margin: 0; font-size: 1rem; }

.al-list-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}
.al-list-item:first-child { border-top: none; padding-top: 0; }
.al-list-date {
  flex: 0 0 auto;
  width: 46px;
  text-align: center;
  background: var(--surface-alt);
  border-radius: 10px;
  padding: 6px 4px;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--accent-strong);
  line-height: 1.2;
}
.al-list-item div.al-list-main { flex: 1 1 auto; min-width: 0; }
.al-list-item strong { display: block; font-size: 0.92rem; }
.al-list-item span { color: var(--muted); font-size: 0.82rem; }

.al-badge {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}
.al-badge.ok { background: #dcfce7; color: #166534; }
.al-badge.warn { background: #fef3c7; color: #92400e; }
.al-badge.muted { background: var(--surface-alt); color: var(--muted); }

.al-empty { color: var(--muted); font-size: 0.86rem; padding: 10px 0; }

.al-bottomnav { display: none; }

/* ---------- Responsive ---------- */

@media (max-width: 860px) {
  .al-shell { grid-template-columns: 1fr; }
  .al-sidebar { display: none; }
  .al-main { padding: 18px 16px 90px; }
  .al-bottomnav {
    display: flex;
    justify-content: space-around;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    background: var(--surface);
    border-top: 1px solid var(--line);
    padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
    z-index: 20;
  }
  .al-bottomnav button {
    border: none;
    background: transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    font-size: 0.66rem;
    font-weight: 700;
    color: var(--muted);
    padding: 4px 10px;
  }
  .al-bottomnav button.active { color: var(--accent); }
}
