/* EduPathway-inspired administration shell. Loaded last to preserve functional selectors. */

:root,
body,
body.country-australia,
body.country-china,
body.country-philippines {
  --primary: #2463e8;
  --primary-dark: #174cbf;
  --country-brand: #2463e8;
  --country-soft: #eaf1ff;
  --country-line: #d9e3f2;
  --country-shadow: rgba(36, 99, 232, 0.14);
  --surface: #ffffff;
  --text: #102657;
  --ink: #102657;
  --muted: #66779b;
  --line: #dde5f2;
  --shadow-soft: 0 8px 24px rgba(21, 48, 95, 0.07);
  --shadow-focus: 0 0 0 3px rgba(54, 120, 246, 0.14);
}

body {
  background: #f4f7fc;
  color: #102657;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

input,
textarea,
select {
  border-color: #cbd7e8 !important;
  border-radius: 9px !important;
}

input:focus,
textarea:focus,
select:focus {
  border-color: #3678f6 !important;
  box-shadow: 0 0 0 3px rgba(54, 120, 246, 0.14) !important;
  outline: 0;
}

.primary-button {
  border-color: #2463e8 !important;
  border-radius: 9px !important;
  color: #fff !important;
  background: linear-gradient(135deg, #3678f6, #2463e8) !important;
  box-shadow: 0 7px 16px rgba(36, 99, 232, 0.2) !important;
}

/* Authentication */

.login-gate {
  padding: clamp(24px, 5vw, 72px);
  background:
    radial-gradient(circle at 15% 18%, rgba(54, 120, 246, 0.28), transparent 30%),
    linear-gradient(135deg, #071a3b 0%, #0b234d 43%, #edf3fc 43%, #f4f7fc 100%);
  isolation: isolate;
}

.login-gate::before {
  content: "EP\A EduPathway\A\A INTELLIGENT. AUTOMATE. SUCCESS.";
  position: fixed;
  left: clamp(36px, 8vw, 130px);
  top: 50%;
  width: min(31vw, 420px);
  color: #fff;
  font-size: clamp(15px, 1.7vw, 24px);
  font-weight: 850;
  line-height: 1.45;
  letter-spacing: -0.025em;
  white-space: pre-line;
  transform: translateY(-50%);
  z-index: -1;
}

.login-gate-card {
  width: min(460px, 100%);
  margin-left: min(44vw, 620px);
  padding: clamp(28px, 4vw, 44px);
  border: 1px solid #cbd7e8;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 28px 70px rgba(7, 26, 59, 0.18);
}

.login-gate-card .eyebrow {
  justify-self: start;
  width: fit-content;
  padding: 6px 10px;
  border-radius: 999px;
  color: #2463e8;
  background: #eaf1ff;
  font-size: 11px;
  letter-spacing: 0.1em;
}

.login-gate-card h1 { color: #102657; font-size: clamp(30px, 3vw, 40px); letter-spacing: -0.035em; }
.login-gate-card p { color: #66779b; }
.login-gate-card label { color: #40547b; font-size: 13px; }
.login-gate-card button { border-radius: 9px; }

/* Desktop administration frame */

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  grid-template-rows: 86px minmax(calc(100vh - 86px), 1fr);
  background: #f4f7fc;
}

.app-header {
  position: sticky;
  top: 0;
  grid-column: 1;
  grid-row: 1 / 3;
  z-index: 40;
  min-height: 100vh;
  max-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 14px;
  padding: 26px 16px 22px;
  border: 0;
  border-radius: 0;
  color: #fff;
  background:
    radial-gradient(circle at 72% 9%, rgba(54, 120, 246, 0.23), transparent 24%),
    linear-gradient(180deg, #071a3b, #0b234d);
  box-shadow: 10px 0 30px rgba(7, 26, 59, 0.09);
  overflow-x: hidden;
  overflow-y: auto;
}

.admin-sidebar-brand { display: grid; gap: 5px; padding: 2px 10px 14px; }
.admin-sidebar-brand strong { color: #fff; font-size: 21px; letter-spacing: -0.035em; }
.admin-sidebar-brand strong span { color: #70a1ff; }
.admin-sidebar-brand small { color: rgba(255, 255, 255, 0.46); font-size: 8px; font-weight: 800; letter-spacing: 0.09em; }

.admin-sidebar-dashboard {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid rgba(112, 156, 255, 0.28);
  border-radius: 9px;
  color: #fff;
  background: linear-gradient(135deg, #2866dc, #315ac0);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.16), inset 3px 0 0 #75a5ff;
  font-size: 13px;
  font-weight: 750;
}

.admin-sidebar-dashboard span { width: 20px; font-size: 18px; text-align: center; }

.header-primary,
.header-actions {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.header-primary > .eyebrow {
  margin: 8px 10px 2px;
  color: rgba(255, 255, 255, 0.45);
  font-size: 9px;
  letter-spacing: 0.08em;
}

.hero-actions { width: 100%; display: grid; gap: 5px; }

.app-header .hero-actions > button,
.app-header .hero-actions > .action-menu > summary,
.app-header .header-actions > button,
.app-header .header-actions > .action-menu > summary {
  width: 100%;
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 0 12px;
  border: 1px solid transparent !important;
  border-radius: 8px !important;
  color: rgba(255, 255, 255, 0.78) !important;
  background: transparent !important;
  box-shadow: none !important;
  font-size: 12px;
  font-weight: 650;
  text-align: left;
}

.app-header .hero-actions > button:hover,
.app-header .hero-actions > .action-menu > summary:hover,
.app-header .header-actions > button:hover,
.app-header .header-actions > .action-menu > summary:hover {
  color: #fff !important;
  background: rgba(255, 255, 255, 0.09) !important;
}

.app-header .action-menu { width: 100%; }
.app-header .action-menu[open] > summary { color: #fff !important; background: rgba(255, 255, 255, 0.1) !important; }
.app-header .menu-list { position: static; width: 100%; margin: 4px 0 8px; padding: 6px; border-color: rgba(255,255,255,.1); background: rgba(2, 16, 39, .68); box-shadow: none; }
.app-header .menu-list button { color: rgba(255,255,255,.74); background: transparent; }
.app-header .menu-list button:hover { color: #fff; background: rgba(255,255,255,.08); }

.country-switcher { width: 100%; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 3px; padding: 4px; border-color: rgba(255,255,255,.1); background: rgba(255,255,255,.05); }
.country-switcher button { min-width: 0; padding: 7px 3px; color: rgba(255,255,255,.56); background: transparent; font-size: 9px; }
.country-switcher button.active { color: #fff; background: #2463e8; box-shadow: none; }

.admin-utility-bar {
  position: sticky;
  top: 0;
  grid-column: 2;
  grid-row: 1;
  z-index: 30;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px clamp(22px, 3vw, 44px);
  border-bottom: 1px solid #dde5f2;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 4px 18px rgba(21, 48, 95, 0.04);
  backdrop-filter: blur(14px);
}

.admin-utility-bar h1 { margin: 0; color: #102657; font-size: clamp(20px, 2vw, 27px); letter-spacing: -0.025em; }
.admin-utility-bar p { margin: 3px 0 0; color: #66779b; font-size: 12px; font-weight: 600; }
.admin-user-pill { display: flex; align-items: center; gap: 9px; padding: 7px 11px 7px 7px; border: 1px solid #dde5f2; border-radius: 999px; color: #102657; background: #fff; font-size: 12px; }
.admin-user-pill span { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 50%; color: #fff; background: linear-gradient(135deg, #3678f6, #8c43d9); font-weight: 800; }

.app-shell > main {
  grid-column: 2;
  grid-row: 2;
  width: 100%;
  max-width: none;
  padding: clamp(22px, 3vw, 38px) clamp(22px, 3vw, 44px) 52px;
  background: #f4f7fc;
}

/* Dashboard cards and workspaces */

.dashboard-metrics { gap: 16px; }
.metric-section {
  gap: 14px;
  padding: 20px;
  border: 1px solid #dde5f2;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(21, 48, 95, 0.07);
}

.metric-review-section,
.pipeline-section,
.daily-task-section { border-color: #dde5f2; background: #fff; }

.metric-section-heading { padding: 0 0 8px; border-bottom: 1px solid #edf1f7; }
.metric-section-heading h2 { color: #102657; font-size: 17px; }
.metric-section-heading p { color: #66779b; }
.metric-section-grid { gap: 10px; }

.metric {
  position: relative;
  overflow: hidden;
  min-height: 86px;
  padding: 13px 14px;
  border: 1px solid #dde5f2;
  border-left: 4px solid #3678f6;
  border-radius: 9px;
  background: #fff;
  box-shadow: none;
}

.metric:nth-child(4n + 2) { border-left-color: #159c72; }
.metric:nth-child(4n + 3) { border-left-color: #8c43d9; }
.metric:nth-child(4n + 4) { border-left-color: #f17a2b; }
.metric.warning { border-color: #f2d9d9; border-left-color: #e44747; background: #fff; }
.metric.ready { border-color: #d7eee6; border-left-color: #159c72; background: #fff; }
.metric:hover, .metric:focus-visible { border-color: #9eb8e2; box-shadow: 0 10px 24px rgba(21, 48, 95, 0.1); }
.metric strong { color: #102657; }
.metric span, .metric small { color: #66779b; }

.today-summary-strip,
.workspace-tabs,
.student-register,
.student-panel,
.finance-workspace,
.data-table-card {
  border-color: #dde5f2;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(21, 48, 95, 0.07);
}

.workspace-tabs button.active { color: #2463e8; background: #eaf1ff; box-shadow: none; }

dialog { border-radius: 16px; box-shadow: 0 28px 90px rgba(7, 26, 59, 0.3); }
dialog::backdrop { background: rgba(7, 26, 59, 0.58); backdrop-filter: blur(3px); }

@media (max-width: 1120px) {
  .app-shell { grid-template-columns: 224px minmax(0, 1fr); }
  .metric-section-grid { grid-template-columns: repeat(3, minmax(140px, 1fr)); }
}

@media (max-width: 860px) {
  .login-gate { padding-top: 120px; background: linear-gradient(160deg, #071a3b 0 28%, #f4f7fc 28%); }
  .login-gate::before { position: absolute; top: 42px; left: 24px; width: auto; font-size: 18px; transform: none; }
  .login-gate-card { margin: 0; }

  .app-shell { display: block; }
  .app-header { position: relative; min-height: 0; max-height: none; padding: 18px 14px; overflow: visible; }
  .admin-sidebar-brand { padding-bottom: 6px; }
  .admin-sidebar-dashboard { display: none; }
  .hero-actions { display: flex; flex-flow: row nowrap; overflow-x: auto; }
  .app-header .hero-actions > button,
  .app-header .hero-actions > .action-menu > summary { min-width: 132px; }
  .header-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .app-header .menu-list { position: absolute; width: min(320px, calc(100vw - 28px)); z-index: 80; }
  .admin-utility-bar { position: sticky; top: 0; padding: 12px 16px; }
  .admin-user-pill strong { display: none; }
  .app-shell > main { padding: 18px 14px 32px; }
  .metric-section-grid,
  .metric-review-grid,
  .daily-task-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
  .header-actions { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .country-switcher { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .admin-utility-bar h1 { font-size: 18px; }
  .admin-utility-bar p { max-width: 65vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .metric-section-grid,
  .metric-review-grid,
  .daily-task-grid { grid-template-columns: 1fr; }
}
