:root {
  --ink: #13201d;
  --muted: #5a6a64;
  --line: #dbe7e1;
  --paper: #f7fbf8;
  --wash: #ecf5ef;
  --green: #18a66b;
  --green-dark: #0b704d;
  --gold: #e6a72e;
  --coral: #cc684f;
  --white: #ffffff;
  --shadow: 0 18px 50px rgba(19, 32, 29, 0.12);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.6;
}

a {
  color: inherit;
  text-decoration: none;
}

.portal-header,
.portal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px clamp(18px, 5vw, 64px);
  background: var(--white);
  border-bottom: 1px solid var(--line);
}

.portal-footer {
  border-top: 1px solid var(--line);
  border-bottom: 0;
  color: var(--muted);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 900;
}

.brand-mark {
  display: inline-grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 8px;
  color: var(--white);
  background: var(--green-dark);
  font-size: 0.82rem;
}

.nav-links {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  color: var(--muted);
  font-weight: 700;
}

.shell {
  width: min(1180px, calc(100% - 36px));
  margin: 0 auto;
  padding: clamp(32px, 6vw, 64px) 0;
}

.admin-dashboard {
  padding-top: clamp(26px, 4vw, 44px);
}

.auth-shell {
  width: min(520px, calc(100% - 36px));
  margin: 0 auto;
  padding: clamp(48px, 8vw, 92px) 0;
}

.panel,
.card,
.stat,
.course-panel,
.table-wrap {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  box-shadow: var(--shadow);
}

.panel {
  padding: 28px;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 12px;
  font-size: clamp(2.1rem, 5vw, 4rem);
  line-height: 1.02;
}

.panel h1,
.auth-shell h1 {
  font-size: clamp(2rem, 4vw, 3rem);
}

h2 {
  margin-bottom: 14px;
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  line-height: 1.1;
}

h3 {
  margin-bottom: 8px;
}

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

.eyebrow {
  margin-bottom: 12px;
  color: var(--green-dark);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.grid {
  display: grid;
  gap: 18px;
}

.grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid.four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.stat,
.card,
.course-panel {
  padding: 22px;
}

.stat strong {
  display: block;
  font-size: 2rem;
  line-height: 1;
}

.dashboard-hero {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
  padding: 4px 0 18px;
  border-bottom: 1px solid var(--line);
}

.clean-hero {
  align-items: center;
  margin-bottom: 18px;
  padding-bottom: 20px;
}

.clean-hero h1 {
  font-size: clamp(2.4rem, 5vw, 4.4rem);
}

.dashboard-hero h1 {
  max-width: 760px;
  margin-bottom: 8px;
}

.dashboard-hero .muted {
  max-width: 720px;
  margin-bottom: 0;
}

.hero-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
}

.stat-card {
  min-height: 118px;
  border-color: #d7e4dc;
  box-shadow: 0 10px 30px rgba(19, 32, 29, 0.08);
}

.stat-card strong {
  font-size: clamp(1.7rem, 3vw, 2.4rem);
}

.online-stat {
  border-color: #a9ddc2;
  background: #f1fff7;
}

.attention-stat {
  border-color: #f0d6a4;
  background: #fff9e9;
}

.simple-stats .stat {
  color: inherit;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.simple-stats .stat:hover {
  transform: translateY(-2px);
  border-color: #adc8ba;
  box-shadow: 0 14px 34px rgba(19, 32, 29, 0.12);
}

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

.quick-link {
  display: grid;
  gap: 4px;
  min-height: 90px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  box-shadow: 0 8px 24px rgba(19, 32, 29, 0.06);
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.quick-link:hover {
  transform: translateY(-2px);
  border-color: #adc8ba;
  box-shadow: 0 14px 34px rgba(19, 32, 29, 0.1);
}

.filter-panel {
  margin-top: 18px;
  padding: 18px;
  box-shadow: 0 10px 30px rgba(19, 32, 29, 0.07);
}

.search-panel {
  margin-top: 18px;
  padding: 18px;
  box-shadow: 0 8px 24px rgba(19, 32, 29, 0.06);
}

.search-form {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(150px, 220px) auto;
  align-items: end;
  gap: 12px;
}

.search-main input {
  min-height: 48px;
}

.search-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.advanced-filters {
  grid-column: 1 / -1;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.advanced-filters summary {
  width: fit-content;
  cursor: pointer;
  color: var(--green-dark);
  font-weight: 900;
}

.advanced-filter-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

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

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  min-height: 46px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--paper);
  font: inherit;
}

.input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

textarea {
  resize: vertical;
}

.large-textarea {
  min-height: 360px;
  font-family: Consolas, "Courier New", monospace;
  line-height: 1.55;
}

.editor-shell {
  display: grid;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--white);
}

.editor-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px;
  border-bottom: 1px solid var(--line);
  background: #f2f7f4;
}

.editor-toolbar button,
.editor-toolbar select,
.editor-color {
  min-height: 36px;
  border-radius: 8px;
  font-size: 0.9rem;
}

.editor-toolbar button {
  padding: 0 10px;
  border: 1px solid var(--line);
  color: var(--ink);
  background: var(--white);
  box-shadow: none;
}

.editor-toolbar select {
  width: auto;
  min-width: 116px;
  padding: 7px 30px 7px 10px;
  background-color: var(--white);
}

.editor-color {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  border: 1px solid var(--line);
  color: var(--ink);
  background: var(--white);
}

.editor-color input {
  width: 28px;
  min-height: 24px;
  padding: 0;
  border: 0;
  background: transparent;
}

.rich-editor {
  min-height: 420px;
  padding: 20px;
  color: var(--ink);
  background: var(--white);
  font-weight: 400;
  outline: 0;
}

.rich-editor:focus {
  box-shadow: inset 0 0 0 3px rgba(24, 166, 107, 0.16);
}

.rich-editor img,
.tutorial-content img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 14px 0;
  border-radius: 8px;
}

.rich-editor blockquote,
.tutorial-content blockquote {
  margin: 16px 0;
  padding: 12px 16px;
  border-left: 4px solid var(--green);
  background: var(--wash);
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
}

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

input:focus,
select:focus,
textarea:focus {
  outline: 3px solid rgba(24, 166, 107, 0.2);
  border-color: var(--green);
}

.button,
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
  font-weight: 900;
}

.button-primary {
  color: var(--white);
  background: var(--green-dark);
}

.button-secondary {
  color: var(--ink);
  border-color: var(--line);
  background: var(--white);
}

.button-danger {
  color: var(--white);
  background: #a3382d;
}

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

.user-actions {
  max-width: 330px;
  gap: 8px;
}

.user-actions .button,
.user-actions button {
  min-height: 36px;
  padding: 0 12px;
  font-size: 0.9rem;
}

.manage-cell {
  display: grid;
  gap: 8px;
  min-width: 150px;
}

.manage-cell > .button,
.manage-cell > button {
  width: 100%;
}

.row-actions-menu {
  position: relative;
}

.row-actions-menu summary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--white);
  cursor: pointer;
  font-weight: 900;
  list-style: none;
}

.row-actions-menu summary::-webkit-details-marker {
  display: none;
}

.row-actions-menu[open] summary {
  border-color: #adc8ba;
  background: var(--wash);
}

.menu-actions {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.menu-actions form {
  display: block;
}

.menu-actions button {
  width: 100%;
  min-height: 36px;
  padding: 0 12px;
  justify-content: flex-start;
  font-size: 0.9rem;
}

.inline-form {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 12px;
}

.inline-form label {
  min-width: min(360px, 100%);
}

.filter-form {
  display: grid;
  grid-template-columns: minmax(220px, 1.5fr) repeat(3, minmax(160px, 1fr)) auto;
  align-items: end;
  gap: 12px;
}

.alert {
  padding: 12px 14px;
  border-radius: 8px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  background: var(--wash);
}

.alert.error {
  color: #7a231b;
  border-color: #f0beb8;
  background: #fff0ee;
}

.alert.success {
  color: #0b704d;
  border-color: #b7e8cd;
  background: #ecfff4;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 900;
}

.status.active {
  color: #07563a;
  background: #d9f4e5;
}

.status.banned {
  color: #7a231b;
  background: #ffe1dc;
}

.status.expired {
  color: #78510c;
  background: #fff0c5;
}

.table-wrap {
  overflow-x: auto;
}

.table-card {
  margin-top: 18px;
  box-shadow: 0 10px 30px rgba(19, 32, 29, 0.08);
}

.table-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-top: 22px;
}

.table-heading h2 {
  margin-bottom: 0;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
}

.table-heading .eyebrow {
  margin-bottom: 4px;
}

.customer-table table {
  min-width: 980px;
}

.customer-table td,
.customer-table th {
  padding: 16px;
}

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

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

th {
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
}

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

.course-panel ol,
.course-panel ul {
  padding-left: 22px;
}

.course-panel li {
  margin-bottom: 8px;
}

.tutorial-content {
  color: var(--ink);
  white-space: normal;
}

.tutorial-content h1,
.tutorial-content h2,
.tutorial-content h3,
.tutorial-content h4 {
  margin-top: 24px;
}

.tutorial-content a {
  color: var(--green-dark);
  font-weight: 800;
  text-decoration: underline;
}

.tutorial-content table {
  width: 100%;
  margin: 16px 0;
  border-collapse: collapse;
}

.tutorial-content th,
.tutorial-content td {
  padding: 10px;
  border: 1px solid var(--line);
}

.tutorial-content figure {
  margin: 18px 0;
}

.tutorial-content figcaption {
  color: var(--muted);
  font-size: 0.92rem;
  text-align: center;
}

.locked {
  border-color: #f0beb8;
  background: #fff7f6;
}

@media (max-width: 860px) {
  .grid.two,
  .grid.three,
  .grid.four {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .quick-grid,
  .search-form,
  .advanced-filter-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-hero {
    align-items: flex-start;
    flex-direction: column;
  }

  .hero-actions {
    justify-content: flex-start;
  }

  .portal-header,
  .portal-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .filter-form {
    grid-template-columns: 1fr;
  }

  .input-row {
    grid-template-columns: 1fr;
  }

  .table-heading {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 560px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .hero-actions,
  .hero-actions .button,
  .hero-actions button {
    width: 100%;
  }
}
