:root {
  --ink: #17313a;
  --muted: #6d7e83;
  --line: #dce6e7;
  --bg: #f4f7f6;
  --primary: #087b70;
  --primary-dark: #075e57;
  --nav: #102f35;
  --accent: #08a4d8;
  --white: #fff;
  --danger: #a83c3c;
  --warning: #98631c;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

a { color: inherit; }

.portal-header {
  height: 88px;
  background: #fff;
  border-bottom: 1px solid #dfe4e8;
  box-shadow: 0 2px 5px #15263b12;
  display: flex;
  align-items: center;
  padding: 0 34px;
  gap: 32px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.portal-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  color: #24364e;
  min-width: 245px;
}

.portal-brand > span {
  width: 52px;
  height: 52px;
  border-radius: 16px 16px 16px 5px;
  background: linear-gradient(145deg, #08a7d7, #087ea9);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 24px;
  font-weight: 900;
}

.portal-brand div { display: grid; }
.portal-brand strong { font-size: 22px; line-height: 1; }
.portal-brand small {
  margin-top: 5px;
  color: #6d7887;
  font-size: 11px;
  letter-spacing: .13em;
  text-transform: uppercase;
}

.module-top-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  flex: 1;
}

.module-top-nav a,
.module-top-nav summary {
  color: #344054;
  text-decoration: none;
  font-size: 15px;
  font-weight: 650;
  padding: 32px 0 27px;
  border-bottom: 4px solid transparent;
  cursor: pointer;
  list-style: none;
}

.module-top-nav a:hover,
.module-top-nav a.active,
.module-top-nav summary:hover {
  color: #058ebd;
  border-bottom-color: #09a4d6;
}

.module-top-nav details { position: relative; }
.module-top-nav details > div {
  position: absolute;
  top: 76px;
  left: -12px;
  min-width: 210px;
  display: grid;
  gap: 2px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px;
  box-shadow: 0 18px 35px #1b345020;
}

.module-top-nav details a {
  padding: 10px 12px;
  border: 0;
  border-radius: 8px;
}

.module-top-nav details a:hover { background: #eef8f7; }

.portal-user {
  display: flex;
  align-items: center;
  gap: 12px;
}

.portal-user > div {
  display: grid;
  text-align: right;
  white-space: nowrap;
}

.portal-user strong { font-size: 13px; }
.portal-user small {
  font-size: 10px;
  color: #768194;
  text-transform: uppercase;
}

.portal-user > span {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #059ed1;
  color: #fff;
  font-size: 18px;
  font-weight: 850;
}

.portal-user form { margin: 0; }
.portal-user button {
  border: 0;
  background: none;
  color: #6b7686;
  font-weight: 700;
  cursor: pointer;
}

.module-main { min-height: calc(100vh - 88px); }

.module-hero {
  min-height: 160px;
  background: linear-gradient(110deg, #06a4da 0%, #0589ba 55%, #057a9e 100%);
  color: #fff;
  display: flex;
  align-items: end;
  justify-content: space-between;
  padding: 34px 44px;
}

.module-hero small {
  display: block;
  color: #dff8ff;
  letter-spacing: .14em;
  font-size: 10px;
  font-weight: 850;
}

.module-hero h1 {
  margin: 7px 0 0;
  font: 750 38px/1.1 Georgia, serif;
}

.module-hero a {
  color: white;
  text-decoration: none;
  font-weight: 800;
}

.content {
  padding: 34px 44px 60px;
  max-width: 1500px;
  margin: 0 auto;
}

.page-title {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 18px;
  margin-bottom: 24px;
}

.page-title h1,
.form-intro h1 {
  font: 750 34px/1.15 Georgia, serif;
  color: #193b40;
  margin: 5px 0 7px;
}

.page-title p,
.form-intro p,
.panel-head p {
  margin: 0;
  color: var(--muted);
}

.eyebrow {
  font-size: 10px;
  letter-spacing: .14em;
  font-weight: 850;
  color: #67908b;
  text-transform: uppercase;
}

.btn {
  border: 0;
  border-radius: 9px;
  padding: 11px 16px;
  font-weight: 750;
  text-decoration: none;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
}

.primary { background: var(--primary); color: white; }
.primary:hover { background: var(--primary-dark); }
.secondary, .ghost { background: white; color: var(--ink); border: 1px solid var(--line); }
.danger { color: var(--danger); }

.actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 15px;
  margin-bottom: 22px;
}

.stats.five { grid-template-columns: repeat(5, 1fr); }

.stats article {
  background: white;
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 20px;
  position: relative;
}

.stats small {
  font-size: 10px;
  color: var(--muted);
  letter-spacing: .08em;
  font-weight: 850;
  text-transform: uppercase;
}

.stats strong {
  display: block;
  font: 750 35px/1 Georgia, serif;
  margin: 10px 0 3px;
}

.stats p { font-size: 12px; color: var(--muted); margin: 0; }
.dot { position: absolute; right: 18px; top: 20px; width: 9px; height: 9px; border-radius: 50%; }
.amber { background: #d79829; }
.green { background: #35a474; }
.blue { background: #3c89bc; }
.purple { background: #8d6bc2; }
.red { background: #bd4a4a; }

.panel {
  background: white;
  border: 1px solid var(--line);
  border-radius: 13px;
  overflow: hidden;
}

.panel.padded { padding: 24px; }
.panel-head { padding: 21px 24px; border-bottom: 1px solid var(--line); }
.panel-head h2 { margin: 0 0 4px; font: 700 20px Georgia, serif; }
.table-wrap { overflow: auto; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left;
  background: #f8faf9;
  color: #60777b;
  font-size: 10px;
  letter-spacing: .08em;
  padding: 13px 18px;
  text-transform: uppercase;
}
td {
  padding: 15px 18px;
  border-top: 1px solid #edf1f1;
  vertical-align: middle;
}
td b { display: block; margin-bottom: 4px; }
td small { display: block; color: var(--muted); font-size: 11px; }

.badge {
  display: inline-block;
  border-radius: 30px;
  padding: 5px 9px;
  font-size: 10px;
  font-weight: 850;
  background: #edf1f1;
  color: #536468;
}
.badge.ok { background: #e3f5ea; color: #24764a; }
.badge.warn { background: #fff1d9; color: #98631c; }
.badge.bad { background: #fbe9e9; color: #a83c3c; }
.badge.info { background: #e4f2ff; color: #236b9c; }

.link { color: var(--primary); font-weight: 750; text-decoration: none; }
.empty { text-align: center; padding: 46px 20px; color: var(--muted); }
.message {
  background: #e4f5ee;
  color: #176b4b;
  border: 1px solid #bde5d3;
  padding: 12px 16px;
  border-radius: 9px;
  margin-bottom: 20px;
}

.filters {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  align-items: end;
  gap: 11px;
  background: white;
  border: 1px solid var(--line);
  padding: 17px;
  border-radius: 13px;
  margin-bottom: 16px;
}

input, select, textarea, .form-control {
  width: 100%;
  border: 1px solid #cad8d9;
  background: white;
  color: var(--ink);
  border-radius: 8px;
  padding: 10px 11px;
  font: inherit;
  outline: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px #087b7015;
}
textarea { min-height: 115px; }
input[type="checkbox"] { width: auto; }

.form-shell { max-width: 860px; margin: auto; }
.form-intro { margin-bottom: 22px; }
.form-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 28px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 19px;
}
.field { display: grid; gap: 7px; }
.field.wide, .form-actions, .errors { grid-column: 1 / -1; }
.field label { font-size: 12px; font-weight: 750; }
.help, .field-error { color: var(--muted); font-size: 12px; margin: 0; }
.field-error, .errors { color: #a22f2f; background: #fff0f0; border-radius: 6px; padding: 7px; }
.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  border-top: 1px solid var(--line);
  padding-top: 20px;
  margin-top: 4px;
}

.dashboard-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.mini-list { padding: 18px 22px; }
.mini-list h3 {
  margin: 8px 0 10px;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: .08em;
  text-transform: uppercase;
}
.mini-list div {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 9px 0;
  border-top: 1px solid #edf1f1;
}
.mini-list span { font-size: 12px; }
.mini-list b { background: #e9f3f2; color: #087b70; border-radius: 20px; padding: 4px 9px; font-size: 11px; }
.chart-box { height: 320px; padding: 16px 22px 24px; }
.method-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; padding: 0 22px 22px; }
.method-grid article { border: 1px solid var(--line); border-radius: 10px; padding: 13px; background: #f8faf9; }
.method-grid small { font-weight: 850; color: var(--muted); font-size: 10px; text-transform: uppercase; }
.method-grid p { margin: 7px 0 0; font-size: 12px; color: var(--ink); }

.login-page {
  min-height: 100vh;
  background: #f3f5f7;
  display: grid;
  place-items: center;
  padding: 0;
}
.login-layout {
  width: 100%;
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(360px, 1fr) minmax(540px, 1fr);
}
.login-identity {
  background: linear-gradient(135deg, #064765 0%, #0479a3 58%, #08a6d4 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 50px;
  text-align: center;
}
.login-logo {
  width: min(360px, 88%);
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 18px 32px #00344c45);
}
.login-identity h2 { font-size: 30px; margin: 34px 0 8px; }
.login-identity p { font-size: 17px; margin: 0; color: #e5f8ff; }
.login-form-zone { display: grid; place-items: center; padding: 42px; background: #f3f5f7; }
.login-card {
  width: min(520px, 100%);
  background: #fff;
  border: 1px solid #d9dde1;
  border-radius: 20px;
  box-shadow: 0 2px 5px #0000001f;
  padding: 42px 36px 38px;
}
.login-card header { text-align: center; margin-bottom: 30px; }
.login-card h1 { font-size: 34px; line-height: 1.2; margin: 0 0 12px; color: #090909; }
.login-card header p { font-size: 18px; color: #707070; margin: 0; }
.login-card form { display: grid; gap: 16px; }
.login-card label { display: grid; gap: 8px; font-size: 15px; font-weight: 750; }
.login-submit {
  min-height: 52px;
  width: 100%;
  border: 0;
  border-radius: 11px;
  background: #171717;
  color: #fff;
  font-weight: 750;
  font-size: 17px;
  cursor: pointer;
}
.login-submit:hover { background: #000; }

@media (max-width: 1250px) {
  .portal-header { gap: 18px; }
  .module-top-nav { gap: 16px; justify-content: flex-start; overflow: auto; }
  .module-top-nav a, .module-top-nav summary { font-size: 14px; white-space: nowrap; }
  .portal-user > div { display: none; }
  .stats.five { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 900px) {
  .portal-header { height: auto; min-height: 76px; padding: 12px 18px; flex-wrap: wrap; }
  .portal-brand { min-width: 0; }
  .module-top-nav { order: 3; width: 100%; }
  .module-top-nav a, .module-top-nav summary { padding: 9px 0 12px; }
  .module-hero { padding: 26px 18px; flex-direction: column; align-items: flex-start; }
  .content { padding: 24px 16px 44px; }
  .stats, .stats.five, .dashboard-grid, .method-grid { grid-template-columns: 1fr 1fr; }
  .form-card { grid-template-columns: 1fr; }
  .field { grid-column: 1; }
  .login-layout { grid-template-columns: 1fr; }
  .login-identity { min-height: 250px; padding: 34px; }
  .login-form-zone { padding: 28px 18px; }
}

@media (max-width: 620px) {
  .portal-brand div, .portal-user > div, .portal-user form { display: none; }
  .module-hero h1 { font-size: 30px; }
  .page-title { align-items: flex-start; flex-direction: column; }
  .stats, .stats.five, .dashboard-grid, .method-grid { grid-template-columns: 1fr; }
  .filters { grid-template-columns: 1fr; }
}
