/* ── Theme tokens — match login.html exactly ────────────────────── */
:root {
  --bg:          #030c10;
  --bg-deep:     #010608;
  --card-bg:     #0b1a24;
  --card-border: rgba(255,255,255,0.09);
  --text:        #e8f1ff;
  --muted:       #9bb0c5;
  --muted-2:     #4a5f70;
  --input-bg:    rgba(255,255,255,0.07);
  --input-bdr:   rgba(255,255,255,0.1);
  --focus:       #34f5d3;
  --accent-teal: #34f5d3;
  --accent-blue: #77c3ff;
  --btn-bg:      #1d5fcc;
  --btn-hover:   #1a54b8;
  --ok-bg:       rgba(10,143,122,0.12); --ok-txt: #34f5d3;  --ok-bdr: rgba(52,245,211,0.22);
  --err-bg:      rgba(239,68,68,0.1);   --err-txt: #f87171; --err-bdr: rgba(239,68,68,0.22);
  --warn-bg:     rgba(245,158,11,0.1);  --warn-txt:#fbbf24; --warn-bdr:rgba(245,158,11,0.22);
  --sidebar-w:   220px;
}
[data-theme="light"] {
  --bg:          #f4f6f9;
  --bg-deep:     #e9ecf0;
  --card-bg:     #ffffff;
  --card-border: #dde2ea;
  --text:        #0f1923;
  --muted:       #5a6a7e;
  --muted-2:     #aab5c0;
  --input-bg:    #f4f6f9;
  --input-bdr:   #dde2ea;
  --focus:       #0a8f7a;
  --accent-teal: #0a8f7a;
  --accent-blue: #1d5fcc;
  --btn-bg:      #1d5fcc;
  --btn-hover:   #1a54b8;
  --ok-bg:       rgba(10,143,122,0.09); --ok-txt: #0a8f7a;  --ok-bdr: rgba(10,143,122,0.2);
  --err-bg:      rgba(239,68,68,0.08);  --err-txt: #dc2626; --err-bdr: rgba(239,68,68,0.18);
  --warn-bg:     rgba(217,119,6,0.08);  --warn-txt:#b45309; --warn-bdr:rgba(217,119,6,0.2);
}

/* ── Reset ──────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: Inter, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  transition: background 0.2s, color 0.2s;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

/* ── App shell ──────────────────────────────────────────────────── */
.app-shell { display: flex; min-height: 100vh; }

/* ── Sidebar — always dark ──────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: #030c10;
  border-right: 1px solid rgba(255,255,255,0.06);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
  transition: transform 0.25s ease;
}
.sidebar-logo {
  padding: 22px 22px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.sidebar-logo .logo-wordmark {
  font-family: Garamond, Georgia, 'Times New Roman', serif;
  font-size: 1.5rem;
  font-weight: 400;
  letter-spacing: 0.5px;
  color: #e8f1ff;
  line-height: 1.15;
  display: block;
}
.sidebar-logo .logo-sub {
  font-size: 0.62rem;
  color: #9bb0c5;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-top: 4px;
  display: block;
}
.sidebar-group {
  padding: 12px 22px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.sidebar-group-label {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: #4a5f70;
  margin-bottom: 2px;
}
.sidebar-group-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: #77c3ff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  overflow-y: auto;
}
.nav-section {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: #4a5f70;
  padding: 8px 12px 4px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 0.84rem;
  font-weight: 500;
  color: #9bb0c5;
  transition: background 0.15s, color 0.15s;
  text-decoration: none;
  margin-bottom: 2px;
}
.nav-item:hover { background: rgba(255,255,255,0.05); color: #e8f1ff; }
.nav-item.active {
  background: rgba(29,95,204,0.15);
  border-left: 2px solid #1d5fcc;
  color: #77c3ff;
  padding-left: 10px;
}
.nav-item svg { width: 15px; height: 15px; flex-shrink: 0; opacity: 0.75; }
.nav-item.active svg { opacity: 1; }
.sidebar-footer {
  padding: 12px 14px 18px;
  border-top: 1px solid rgba(255,255,255,0.06);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sidebar-footer-info {
  font-size: 0.62rem;
  color: #4a5f70;
  line-height: 1.7;
  text-align: center;
  margin-bottom: 2px;
}
.theme-btn {
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  padding: 6px 14px;
  cursor: pointer;
  font-size: 0.72rem;
  color: #9bb0c5;
  font-family: Inter, 'Helvetica Neue', Arial, sans-serif;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
  line-height: 1.6;
  width: 100%;
}
.theme-btn:hover { background: rgba(255,255,255,0.11); color: #e8f1ff; }
.signout-btn {
  background: none;
  border: none;
  color: #4a5f70;
  font-size: 0.72rem;
  font-weight: 500;
  cursor: pointer;
  padding: 4px 0;
  transition: color 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
}
.signout-btn:hover { color: #f87171; }
.signout-btn svg { width: 13px; height: 13px; }

/* ── Mobile topbar ──────────────────────────────────────────────── */
.topbar {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 52px;
  background: #030c10;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  align-items: center;
  padding: 0 16px;
  gap: 12px;
  z-index: 200;
}
.topbar-logo {
  font-family: Garamond, Georgia, 'Times New Roman', serif;
  font-size: 1.15rem;
  color: #e8f1ff;
  flex: 1;
  letter-spacing: 0.5px;
}
.menu-btn {
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 7px;
  padding: 5px 9px;
  color: #9bb0c5;
}
.menu-btn:hover { color: #e8f1ff; }
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 99;
}

/* ── Main content ───────────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  padding: 36px 40px;
  max-width: 900px;
}
.page-header { margin-bottom: 28px; }
.page-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.2;
}
.page-subtitle {
  font-size: 0.86rem;
  color: var(--muted);
  margin-top: 5px;
}

/* ── Cards ──────────────────────────────────────────────────────── */
.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 16px;
  transition: background 0.2s, border-color 0.2s;
}
.card-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}
.card-sub {
  font-size: 0.82rem;
  color: var(--muted);
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

/* ── Announcement ───────────────────────────────────────────────── */
.announcement {
  border: 1px solid var(--card-border);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 16px;
}
.announcement-header {
  background: linear-gradient(100deg, #0f0a3f 0%, #1d5fcc 55%, #0a8f7a 100%);
  padding: 16px 22px;
}
.announcement-tag {
  display: inline-block;
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  background: rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.85);
  border-radius: 4px;
  padding: 2px 7px;
  margin-bottom: 7px;
}
.announcement-title { font-size: 1.05rem; font-weight: 600; color: #fff; }
.announcement-date  { font-size: 0.73rem; color: rgba(255,255,255,0.55); margin-top: 2px; }
.announcement-body  {
  background: var(--card-bg);
  padding: 16px 22px 18px;
}
.announcement-body p {
  font-size: 0.86rem;
  color: var(--muted);
  line-height: 1.65;
  margin-bottom: 12px;
}
.announcement-body p:last-child { margin-bottom: 0; }

/* ── Quick-action grid ──────────────────────────────────────────── */
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 16px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.quick-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 18px 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-decoration: none;
  transition: border-color 0.15s;
}
.quick-card:hover { border-color: rgba(29,95,204,0.5); }
.quick-card-icon {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: rgba(29,95,204,0.12);
  display: flex; align-items: center; justify-content: center;
}
.quick-card-icon svg { width: 15px; height: 15px; color: #77c3ff; }
[data-theme="light"] .quick-card-icon { background: rgba(29,95,204,0.08); }
[data-theme="light"] .quick-card-icon svg { color: #1d5fcc; }
.quick-card-label { font-size: 0.85rem; font-weight: 600; color: var(--text); }
.quick-card-desc  { font-size: 0.76rem; color: var(--muted); line-height: 1.4; }

/* ── Ext link card ──────────────────────────────────────────────── */
.ext-link-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: var(--card-bg);
  border: 1px solid rgba(29,95,204,0.25);
  border-radius: 12px;
  padding: 16px 20px;
  text-decoration: none;
  margin-bottom: 16px;
  transition: border-color 0.15s;
}
.ext-link-card:hover { border-color: rgba(29,95,204,0.55); }
.ext-link-title { font-size: 0.9rem; font-weight: 600; color: var(--text); }
.ext-link-desc  { font-size: 0.78rem; color: var(--muted); margin-top: 3px; }
.ext-link-arrow { color: #77c3ff; flex-shrink: 0; }
.ext-link-arrow svg { width: 16px; height: 16px; }
[data-theme="light"] .ext-link-arrow { color: #1d5fcc; }

/* ── Forms ──────────────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-group:last-child { margin-bottom: 0; }
.field-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 7px;
  letter-spacing: 0.2px;
}
.field-hint {
  font-size: 0.73rem;
  color: var(--muted-2);
  margin-top: 5px;
}
input[type="text"],
input[type="email"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 9px 12px;
  background: var(--input-bg);
  border: 1px solid var(--input-bdr);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.88rem;
  outline: none;
  transition: border-color 0.2s, background 0.2s;
  -webkit-appearance: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--focus); }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 0.55; }
input[disabled], select[disabled] { opacity: 0.5; cursor: not-allowed; }
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='7' viewBox='0 0 12 7'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%239bb0c5' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
  cursor: pointer;
}

/* ── Buttons ────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: 9px;
  font-size: 0.875rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s, background 0.15s;
  text-decoration: none;
  font-family: Inter, 'Helvetica Neue', Arial, sans-serif;
}
.btn:active:not(:disabled) { transform: scale(0.98); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-primary { background: var(--btn-bg); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--btn-hover); }
.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--card-border);
}
.btn-ghost:hover:not(:disabled) { color: var(--text); border-color: var(--muted); }
.btn-sm { padding: 6px 14px; font-size: 0.8rem; border-radius: 7px; }
.btn svg { width: 14px; height: 14px; }
.w-full { width: 100%; }

/* ── User list ──────────────────────────────────────────────────── */
.user-list { display: flex; flex-direction: column; gap: 10px; }
.user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--input-bg);
  border: 1px solid var(--card-border);
  border-radius: 9px;
  gap: 12px;
}
.user-name  { font-size: 0.88rem; font-weight: 500; color: var(--text); }
.user-email { font-size: 0.78rem; color: var(--muted); margin-top: 1px; }
.freq-badge {
  font-size: 0.73rem;
  color: var(--muted);
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  padding: 3px 9px;
  border-radius: 6px;
  white-space: nowrap;
}

/* ── Divider ────────────────────────────────────────────────────── */
.divider { height: 1px; background: var(--card-border); margin: 20px 0; }

/* ── Toast ──────────────────────────────────────────────────────── */
#toast-wrap {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  pointer-events: none;
}
.toast {
  min-width: 220px; max-width: 340px;
  padding: 11px 15px;
  border-radius: 10px;
  font-size: 0.84rem;
  font-weight: 500;
  line-height: 1.4;
  pointer-events: all;
  animation: toast-in 0.2s ease forwards;
  box-shadow: 0 4px 20px rgba(0,0,0,0.35);
}
.toast.ok   { background: var(--ok-bg);   color: var(--ok-txt);   border: 1px solid var(--ok-bdr); }
.toast.err  { background: var(--err-bg);  color: var(--err-txt);  border: 1px solid var(--err-bdr); }
.toast.warn { background: var(--warn-bg); color: var(--warn-txt); border: 1px solid var(--warn-bdr); }
@keyframes toast-in {
  from { transform: translateX(20px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* ── Spinner ────────────────────────────────────────────────────── */
.spin {
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: rotate 0.6s linear infinite;
  flex-shrink: 0;
}
@keyframes rotate { to { transform: rotate(360deg); } }

/* ── Page loading ───────────────────────────────────────────────── */
.page-loading {
  position: fixed; inset: 0;
  background: #030c10;
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 18px;
  z-index: 999;
}
.page-loading .pl-logo {
  font-family: Garamond, Georgia, 'Times New Roman', serif;
  font-size: 1.9rem; font-weight: 400; letter-spacing: 1px;
  color: #e8f1ff;
}
.page-loading .pl-spinner {
  width: 26px; height: 26px;
  border: 2px solid rgba(255,255,255,0.12);
  border-top-color: #34f5d3;
  border-radius: 50%;
  animation: rotate 0.65s linear infinite;
}

/* ── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 760px) {
  .topbar { display: flex; }
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.show { display: block; }
  .main-content { margin-left: 0; padding: 68px 18px 32px; }
  .grid-3 { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  #toast-wrap { bottom: 16px; right: 12px; left: 12px; }
  .toast { max-width: 100%; min-width: unset; }
}
@media (max-width: 480px) {
  .main-content { padding: 64px 14px 28px; }
  .card { padding: 18px 16px; }
}
