/* =========================================================
   SHPD DIGITAL SERVICES PORTAL
   Full CSS Replacement
   Light base + compact SHPD system header
========================================================= */

:root {
  --bg: #f3f5f7;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --ink: #17212b;
  --muted: #5e6a78;
  --line: rgba(23, 33, 43, 0.14);

  --black: #000000;
  --header-black: #000000;
  --header-text: #ffffff;

  --gold: #d39a21;
  --gold-light: #efb744;
  --gold-soft: #fff3d8;

  --blue: #0a7ec2;
  --blue-soft: #e9f5ff;

  --danger: #b42318;
  --success: #237a4d;

  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
  --max: 1240px;

  --font-main: Arial, Helvetica, sans-serif;
}

/* Dark mode variables */
body.dark-mode {
  --bg: #080b0f;
  --panel: #131820;
  --panel-soft: #171d26;
  --ink: #f8fafc;
  --muted: #c5ced9;
  --line: rgba(255, 255, 255, 0.14);
  --gold-soft: rgba(211, 154, 33, 0.14);
  --blue-soft: rgba(10, 126, 194, 0.15);
  --shadow: 0 14px 34px rgba(0, 0, 0, 0.22);
}

/* =========================================================
   Base
========================================================= */

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-main);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
  min-height: 100vh;
}

a {
  color: inherit;
}

img {
  max-width: 100%;
}

button,
input,
select,
textarea {
  font-family: inherit;
}

/* =========================================================
   SHPD Header — matches training system screenshot style
========================================================= */

.portal-header {
  width: calc(100% - 32px);
  max-width: 1480px;
  margin: 10px auto 22px;
  background: var(--header-black);
  color: var(--header-text);
  border-radius: 14px;
  border-bottom: 7px solid var(--gold);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.14);
  overflow: hidden;
}

.portal-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  padding: 28px 34px 24px;
}

.portal-header-left {
  display: flex;
  align-items: center;
  gap: 24px;
  min-width: 0;
  flex: 1 1 auto;
}

.portal-badge {
  width: 140px;
  height: auto;
  display: block;
  flex: 0 0 auto;
}

.header-content {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}

.header-content h1 {
  margin: 0 0 8px;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 0.5px;
  line-height: 1.08;
  color: #ffffff;
  text-transform: uppercase;
}

.header-content p {
  margin: 0 0 6px;
  font-size: 15px;
  line-height: 1.35;
  color: rgba(255, 255, 255, 0.94);
}

.header-sub-link {
  display: inline-block;
  width: fit-content;
  font-size: 14px;
  line-height: 1.3;
  color: #72c7ff;
  text-decoration: none;
}

.header-sub-link:hover,
.header-sub-link:focus {
  text-decoration: underline;
}

.portal-header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex: 0 0 auto;
  flex-wrap: wrap;
}

.header-btn,
.portal-header-actions a,
.portal-header-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: #111317;
  color: #ffffff;
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.header-btn:hover,
.portal-header-actions a:hover,
.portal-header-actions button:hover {
  background: #1d2128;
  border-color: rgba(255, 255, 255, 0.28);
  transform: translateY(-1px);
}

.header-btn.primary,
.portal-header-actions .primary,
.portal-header-actions a[href*="login"],
.portal-header-actions a[href*="dashboard"] {
  background: var(--gold);
  color: #111111;
  border-color: var(--gold);
  box-shadow: 0 0 18px rgba(211, 154, 33, 0.28);
}

.header-btn.primary:hover,
.portal-header-actions .primary:hover,
.portal-header-actions a[href*="login"]:hover,
.portal-header-actions a[href*="dashboard"]:hover {
  background: var(--gold-light);
  border-color: var(--gold-light);
}

/* =========================================================
   Layout
========================================================= */

.page,
.portal-main,
main {
  width: calc(100% - 32px);
  max-width: var(--max);
  margin: 0 auto;
}

.page-shell,
.content-shell,
.dashboard-shell {
  width: calc(100% - 32px);
  max-width: var(--max);
  margin: 0 auto 48px;
}

.page-top,
.dashboard-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 22px;
  margin-bottom: 24px;
}

.page-title-block h1,
.dashboard-title h1,
main h1 {
  margin: 0 0 8px;
  font-size: clamp(2rem, 3vw, 3rem);
  line-height: 1.05;
  letter-spacing: -0.04em;
  color: var(--ink);
}

.page-title-block p,
.dashboard-title p,
.lead {
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
}

.eyebrow,
.kicker,
.badge-label {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  gap: 8px;
  margin-bottom: 14px;
  padding: 7px 13px;
  border-radius: 999px;
  background: var(--gold-soft);
  border: 1px solid rgba(211, 154, 33, 0.36);
  color: #6d4810;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

body.dark-mode .eyebrow,
body.dark-mode .kicker,
body.dark-mode .badge-label {
  color: var(--gold-light);
}

/* =========================================================
   Buttons
========================================================= */

.btn,
.button,
.action-btn,
.tool-btn,
.open-tool,
.form-actions a,
.form-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.btn:hover,
.button:hover,
.action-btn:hover,
.tool-btn:hover,
.open-tool:hover,
.form-actions a:hover,
.form-actions button:hover {
  transform: translateY(-1px);
  border-color: rgba(211, 154, 33, 0.55);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
}

.btn.primary,
.button.primary,
.action-btn.primary,
.tool-btn.primary,
.open-tool,
.form-actions button[type="submit"] {
  background: var(--gold-light);
  color: #111111;
  border-color: var(--gold-light);
}

.btn.secondary,
.button.secondary,
.action-btn.secondary {
  background: var(--panel-soft);
  color: var(--ink);
}

.btn.danger,
.button.danger {
  background: #fff1f0;
  color: var(--danger);
  border-color: rgba(180, 35, 24, 0.25);
}

body.dark-mode .btn.danger,
body.dark-mode .button.danger {
  background: rgba(180, 35, 24, 0.14);
}

/* =========================================================
   Login Page
========================================================= */

.login-wrap,
.auth-wrap {
  width: calc(100% - 32px);
  max-width: 460px;
  margin: 44px auto;
}

.login-card,
.auth-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
}

.login-card h2,
.auth-card h2 {
  margin: 0 0 8px;
  font-size: 2rem;
  letter-spacing: -0.035em;
}

.login-card p,
.auth-card p {
  color: var(--muted);
  margin: 0 0 22px;
}

/* =========================================================
   Forms
========================================================= */

form {
  margin: 0;
}

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

.form-row {
  display: grid;
  gap: 7px;
  margin-bottom: 16px;
}

.form-row label,
label {
  font-size: 13px;
  font-weight: 800;
  color: var(--ink);
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  color: var(--ink);
  padding: 10px 12px;
  font-size: 15px;
  outline: none;
}

textarea {
  min-height: 120px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(211, 154, 33, 0.75);
  box-shadow: 0 0 0 4px rgba(211, 154, 33, 0.16);
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 18px;
}

/* =========================================================
   Alerts / Notices
========================================================= */

.alert,
.notice,
.message {
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--panel);
  padding: 14px 16px;
  margin-bottom: 18px;
  color: var(--muted);
}

.alert.success,
.message.success {
  background: rgba(35, 122, 77, 0.10);
  border-color: rgba(35, 122, 77, 0.26);
  color: var(--success);
}

.alert.error,
.message.error {
  background: rgba(180, 35, 24, 0.10);
  border-color: rgba(180, 35, 24, 0.26);
  color: var(--danger);
}

.notice strong,
.alert strong {
  color: var(--ink);
}

/* =========================================================
   Tool Dashboard
========================================================= */

.tools-header,
.dashboard-actions,
.page-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}

.tool-category,
.category-section,
.tools-section {
  margin: 26px 0 34px;
}

.tool-category h2,
.category-section h2,
.tools-section h2 {
  margin: 0 0 14px;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.tools-grid,
.tool-grid,
.card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.tool-card,
.card,
.admin-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}

.tool-card {
  display: flex;
  flex-direction: column;
  min-height: 210px;
}

.tool-card-top,
.card-top {
  margin-bottom: 12px;
}

.tool-label,
.card-category,
.category-label {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  margin-bottom: 14px;
  padding: 5px 9px;
  border-radius: 999px;
  background: var(--gold-soft);
  color: #6d4810;
  border: 1px solid rgba(211, 154, 33, 0.28);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

body.dark-mode .tool-label,
body.dark-mode .card-category,
body.dark-mode .category-label {
  color: var(--gold-light);
}

.tool-card h3,
.card h3,
.admin-card h3 {
  margin: 0 0 9px;
  color: var(--ink);
  font-size: 1.05rem;
  line-height: 1.25;
}

.tool-card p,
.card p,
.admin-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.96rem;
}

.tool-card-footer,
.card-footer {
  margin-top: auto;
  padding-top: 18px;
}

/* =========================================================
   Admin Tables / Lists
========================================================= */

.table-wrap {
  overflow-x: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  background: var(--panel-soft);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

td {
  color: var(--ink);
  font-size: 14px;
}

tr:last-child td {
  border-bottom: none;
}

.inline-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* =========================================================
   Admin Forms / Edit Panels
========================================================= */

.admin-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

.admin-panel,
.edit-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}

.admin-panel h2,
.edit-panel h2 {
  margin: 0 0 16px;
  font-size: 1.45rem;
  letter-spacing: -0.025em;
}

.two-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.three-col {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 9px;
}

.checkbox-row input {
  width: auto;
  min-height: auto;
}

/* =========================================================
   Public Welcome Cards
========================================================= */

.hero,
.welcome-hero {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
  margin-bottom: 24px;
}

.hero h2,
.welcome-hero h2 {
  margin: 0 0 10px;
  font-size: clamp(2rem, 4vw, 3.2rem);
  line-height: 1.02;
  letter-spacing: -0.05em;
}

.hero p,
.welcome-hero p {
  color: var(--muted);
  max-width: 760px;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

/* =========================================================
   Footer
========================================================= */

.portal-footer,
footer {
  width: calc(100% - 32px);
  max-width: var(--max);
  margin: 42px auto 28px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.portal-footer a,
footer a {
  color: var(--ink);
  font-weight: 700;
}

/* =========================================================
   Utility Classes
========================================================= */

.muted {
  color: var(--muted);
}

.text-small {
  font-size: 13px;
}

.center {
  text-align: center;
}

.hidden {
  display: none !important;
}

.spacer {
  height: 20px;
}

/* =========================================================
   Responsive
========================================================= */

@media (max-width: 1100px) {
  .portal-header-inner {
    align-items: flex-start;
    flex-direction: column;
  }

  .portal-header-actions {
    justify-content: flex-start;
  }

  .tools-grid,
  .tool-grid,
  .card-grid,
  .info-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .page-top,
  .dashboard-top {
    flex-direction: column;
  }
}

@media (max-width: 720px) {
  .portal-header {
    width: calc(100% - 20px);
    margin: 8px auto 18px;
    border-radius: 14px;
  }

  .portal-header-inner {
    padding: 20px 18px 18px;
    gap: 16px;
  }

  .portal-header-left {
    gap: 16px;
    align-items: center;
  }

  .portal-badge {
    width: 66px;
  }

  .header-content h1 {
    font-size: 22px;
    line-height: 1.12;
  }

  .header-content p {
    font-size: 14px;
  }

  .header-sub-link {
    font-size: 13px;
  }

  .portal-header-actions {
    gap: 8px;
  }

  .header-btn,
  .portal-header-actions a,
  .portal-header-actions button {
    min-height: 36px;
    padding: 0 13px;
    font-size: 12px;
  }

  .tools-grid,
  .tool-grid,
  .card-grid,
  .info-grid,
  .two-col,
  .three-col {
    grid-template-columns: 1fr;
  }

  .page,
  .portal-main,
  main,
  .page-shell,
  .content-shell,
  .dashboard-shell,
  .login-wrap,
  .auth-wrap {
    width: calc(100% - 20px);
  }

  .tool-card,
  .card,
  .admin-card,
  .admin-panel,
  .edit-panel,
  .login-card,
  .auth-card,
  .hero,
  .welcome-hero {
    padding: 18px;
  }
}

@media (max-width: 480px) {
  .portal-header-left {
    align-items: flex-start;
  }

  .portal-badge {
    width: 58px;
  }

  .header-content h1 {
    font-size: 20px;
  }

  .portal-header-actions {
    width: 100%;
  }

  .header-btn,
  .portal-header-actions a,
  .portal-header-actions button {
    flex: 1 1 auto;
  }
}