:root {
  --bg: #edf3ff;
  --bg-soft: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --primary: #0b66ff;
  --primary-dark: #0049b7;
  --line: #d8e2f1;
  --ok: #1f9d5a;
  --err: #d14343;
  --shadow: 0 24px 60px rgba(14, 30, 66, 0.15);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "SF Pro Display", "PingFang SC", "Helvetica Neue", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 15% 15%, #dbe9ff 0, transparent 40%),
    radial-gradient(circle at 90% 80%, #d7f2ff 0, transparent 38%),
    var(--bg);
  min-height: 100vh;
}

.auth-shell {
  max-width: 980px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 40px 20px;
  display: grid;
  align-items: center;
  gap: 24px;
  grid-template-columns: 1.2fr 1fr;
}

.card,
.sidebar,
.app-content {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.card {
  padding: 30px;
}

.card h2,
.brand-panel h1,
.app-header h1 {
  margin: 0 0 10px;
}

.brand-panel {
  padding: 12px;
}

.brand-panel p,
.sub,
.hint,
.panel p {
  color: var(--muted);
}

.chip {
  margin: 0 0 10px;
  font-size: 12px;
  letter-spacing: 0.12em;
  font-weight: 700;
  color: var(--primary-dark);
}

.form {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.form.slim {
  max-width: 520px;
}

label {
  font-size: 14px;
  color: #334155;
}

input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: #fff;
}

input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(21, 101, 216, 0.15);
}

input[readonly] {
  color: #475569;
  background: #f8fbff;
}

button {
  margin-top: 8px;
  border: none;
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 15px;
  font-weight: 700;
  background: linear-gradient(120deg, var(--primary), var(--primary-dark));
  color: #fff;
  cursor: pointer;
  transition: transform 0.15s, filter 0.2s;
}

button:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
}

button.ghost {
  background: #e6eefc;
  color: var(--primary-dark);
}

.wide-btn {
  width: 100%;
}

.alert {
  margin-top: 8px;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
}

.alert.error {
  background: #ffe8e8;
  color: var(--err);
}

.alert.success {
  background: #e7f8ef;
  color: var(--ok);
}

.hint {
  margin: 14px 0 0;
  font-size: 14px;
}

.hint a {
  color: var(--primary-dark);
  text-decoration: none;
  font-weight: 600;
}

.app-shell {
  max-width: 1240px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 18px;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 18px;
  position: relative;
}

.sidebar {
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 36px);
  transition: transform 0.25s ease, width 0.25s ease;
}

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

.brand-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #ebf3ff, #d8e6ff);
  border: 1px solid #c6d9ff;
}

.brand-icon svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: #0f4cab;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.brand-text h2 {
  margin: 0;
  font-size: 18px;
}

.brand-text p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.nav-list {
  display: grid;
  gap: 8px;
  margin-top: 6px;
}

.nav-link {
  color: #1f2a44;
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 11px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
  transition: border-color 0.2s, background 0.2s;
}

.nav-link svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: #0f4cab;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.nav-link:hover {
  border-color: #cfdbf7;
  background: #f7faff;
}

.nav-link.active {
  background: #eaf2ff;
  border-color: #c4d8ff;
  color: #0e3f95;
}

.dot {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: #0f62ff;
  color: #fff;
  font-size: 11px;
  font-style: normal;
  display: grid;
  place-items: center;
}

.logout-wrap {
  margin-top: auto;
}

.app-content {
  padding: 24px;
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.app-header h1 {
  font-size: 28px;
}

.icon-btn {
  margin: 0;
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 10px;
  background: #e6eefc;
  color: #0f4cab;
  font-size: 18px;
}

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

.stat-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  background: #f8fbff;
}

.stat-card h3 {
  margin: 8px 0 6px;
  font-size: 15px;
}

.stat-card p {
  margin: 0;
  color: #2f3f63;
  font-size: 14px;
}

.stat-icon {
  font-size: 21px;
}

.panel {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  background: #fcfdff;
}

.panel h2,
.message-item h3 {
  margin: 0;
}

.quick-grid {
  margin-top: 12px;
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.quick-grid a {
  text-decoration: none;
  border: 1px solid #d0def7;
  border-radius: 12px;
  padding: 14px;
  color: #16479e;
  font-weight: 600;
  background: #f2f7ff;
}

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

.message-list {
  margin-top: 12px;
  display: grid;
  gap: 10px;
}

.message-item {
  border: 1px solid #d3def4;
  border-left: 5px solid #0d63ff;
  border-radius: 12px;
  padding: 12px 14px;
  background: #f5f9ff;
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.message-item.read {
  border-left-color: #95a7cb;
  background: #f9fbff;
}

.message-item h3 {
  font-size: 15px;
}

.message-item p {
  margin: 6px 0 0;
  color: #4f5f7a;
  font-size: 14px;
}

.message-item time {
  color: #6a7b9a;
  white-space: nowrap;
  font-size: 12px;
}

.mobile-only {
  display: none;
}

.mobile-mask {
  display: none;
}

.app-shell.nav-collapsed {
  grid-template-columns: 92px minmax(0, 1fr);
}

.app-shell.nav-collapsed .brand {
  justify-content: center;
}

.app-shell.nav-collapsed .brand-text,
.app-shell.nav-collapsed .nav-link span,
.app-shell.nav-collapsed .dot,
.app-shell.nav-collapsed .logout-wrap button {
  display: none;
}

.app-shell.nav-collapsed .nav-link {
  justify-content: center;
  padding-inline: 0;
}

.app-shell.nav-collapsed .logout-wrap {
  display: grid;
  place-items: center;
}

.app-shell.nav-collapsed .logout-wrap::before {
  content: "↩";
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid #d0def7;
  background: #f1f6ff;
  display: grid;
  place-items: center;
  color: #0f4cab;
  font-weight: 700;
}

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

  .quick-grid {
    grid-template-columns: 1fr;
  }
}

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

  .app-shell {
    grid-template-columns: 1fr;
    padding: 14px;
  }

  .desktop-only {
    display: none;
  }

  .mobile-only {
    display: inline-grid;
    place-items: center;
  }

  .sidebar {
    position: fixed;
    left: 14px;
    top: 14px;
    bottom: 14px;
    width: min(82vw, 288px);
    min-height: auto;
    transform: translateX(-120%);
    z-index: 50;
  }

  .app-shell.nav-open .sidebar {
    transform: translateX(0);
  }

  .app-content {
    padding: 18px;
  }

  .app-header h1 {
    font-size: 24px;
  }

  .mobile-mask {
    position: fixed;
    inset: 0;
    background: rgba(6, 23, 55, 0.38);
    z-index: 40;
  }

  .app-shell.nav-open .mobile-mask {
    display: block;
  }

  .app-shell.nav-collapsed {
    grid-template-columns: 1fr;
  }

  .message-item {
    flex-direction: column;
  }
}
