:root {
  --primary: #b22222;
  --secondary: #f4c542;
  --text: #1f1f1f;
  --muted: #666;
  --bg: #ffffff;
  --surface: #fffdf7;
  --border: #e9e3d0;
  --max-width: 920px;
  --radius: 14px;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "Noto Sans", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover,
a:focus-visible {
  text-decoration: underline;
}

.container {
  width: min(100% - 2rem, var(--max-width));
  margin-inline: auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.97);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(6px);
}

.nav-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem 0;
}

.brand {
  font-weight: 700;
  color: var(--primary);
  font-size: 1.05rem;
}

.nav-links {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nav-links a {
  color: var(--text);
  font-weight: 500;
}

.nav-links a[aria-current="page"] {
  color: var(--primary);
}

.section {
  padding: 2.5rem 0;
}

.hero {
  background: linear-gradient(145deg, #fff6d7 0%, #ffffff 70%);
  border-bottom: 1px solid var(--border);
}

.eyebrow {
  display: inline-block;
  margin: 0 0 0.5rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  background: var(--secondary);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

h1,
h2,
h3 {
  line-height: 1.25;
  margin: 0 0 0.9rem;
}

h1 {
  font-size: clamp(1.8rem, 4.3vw, 2.8rem);
}

h2 {
  font-size: clamp(1.25rem, 2.8vw, 1.7rem);
  color: var(--primary);
}

.subtitle {
  font-size: clamp(1.05rem, 2.3vw, 1.25rem);
  margin-top: 0;
  color: #313131;
}

.card,
.policy {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.3rem 1.2rem;
}

.feature-list {
  margin: 0;
  padding-left: 1.2rem;
  display: grid;
  gap: 0.55rem;
}

.compliance {
  background: linear-gradient(170deg, #ffffff 0%, #fff9e8 100%);
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1rem;
}

.button {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  padding: 0.65rem 1rem;
  border-radius: 10px;
  font-weight: 600;
  border: 1px solid transparent;
}

.button:hover,
.button:focus-visible {
  text-decoration: none;
  opacity: 0.95;
}

.button-alt {
  background: #fff;
  color: var(--primary);
  border-color: var(--primary);
}

.button:disabled,
.button-alt:disabled,
.nav-button:disabled,
.text-button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.meta {
  color: var(--muted);
  margin-top: -0.2rem;
}

.policy ul,
.policy ol {
  padding-left: 1.2rem;
}

.site-footer {
  margin-top: 2rem;
  border-top: 1px solid var(--border);
  background: #fffdf5;
}

.footer-wrap {
  padding: 1rem 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.9rem;
  flex-wrap: wrap;
}

.footer-wrap p {
  margin: 0;
  color: #444;
}

.subtle-link {
  color: var(--muted);
  font-size: 0.92rem;
}

.nav-text {
  color: var(--muted);
  font-size: 0.95rem;
}

.nav-button,
.text-button {
  border: 0;
  background: transparent;
  color: var(--primary);
  font: inherit;
  padding: 0;
  cursor: pointer;
}

.auth-shell {
  display: grid;
  place-items: center;
  min-height: calc(100vh - 13rem);
}

.auth-card {
  width: min(100%, 520px);
  background: linear-gradient(170deg, #fffdf7 0%, #ffffff 100%);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 2rem;
}

.auth-form,
.field {
  display: grid;
  gap: 0.55rem;
}

.auth-form {
  margin-top: 1.4rem;
}

.field span,
.inline-field span {
  font-size: 0.92rem;
  font-weight: 600;
}

.field input,
.inline-field select,
.phrase-table input,
.phrase-table select,
.phrase-table textarea {
  width: 100%;
  border: 1px solid #d2c7ac;
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  font: inherit;
  padding: 0.75rem 0.85rem;
}

.password-field {
  position: relative;
}

.password-field input {
  padding-right: 5.5rem;
}

.password-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  top: 50%;
  right: 0.55rem;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  color: var(--primary);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0.2rem 0.35rem;
}

.password-toggle-icon {
  width: 1.2rem;
  height: 1.2rem;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.password-toggle .eye-closed {
  display: none;
}

.password-toggle.is-visible .eye-open {
  display: none;
}

.password-toggle.is-visible .eye-closed {
  display: inline;
}

.phrase-table textarea {
  resize: vertical;
  min-width: 220px;
}

.status-message {
  min-height: 1.5rem;
  margin: 0;
  color: var(--muted);
}

.status-message.error,
.row-message.error {
  color: #b42318;
}

.status-message.success,
.row-message.success {
  color: #167c3d;
}

.reset-page {
  min-height: 100vh;
  background:
    radial-gradient(circle at top right, rgba(244, 197, 66, 0.24), transparent 28%),
    linear-gradient(180deg, #fffaf0 0%, #ffffff 100%);
}

.reset-card {
  width: min(100%, 560px);
}

.token-notice,
.form-hint {
  margin: 0;
  color: var(--muted);
}

.token-notice.error {
  color: #b42318;
}

.token-notice.success {
  color: #167c3d;
}

.admin-layout,
.admin-sections {
  display: grid;
  gap: 1.25rem;
}

.admin-page-container {
  width: min(100% - 1rem, 1700px);
}

.admin-hero {
  background: linear-gradient(145deg, #fff6d7 0%, #fffdf7 45%, #ffffff 100%);
}

.admin-hero-actions {
  margin-top: 1.25rem;
}

.toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.toolbar-actions {
  display: flex;
  align-items: flex-end;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.toolbar-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.inline-field {
  display: grid;
  gap: 0.45rem;
  min-width: 140px;
}

.category-section h2 {
  margin-bottom: 1rem;
}

.table-shell {
  display: grid;
  gap: 0.4rem;
}

.table-hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.table-top-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  height: 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff6d7;
}

.table-top-scroll-inner {
  height: 1px;
}

.table-wrap {
  overflow-x: auto;
  overflow-y: visible;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #fff;
}

.phrase-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1320px;
  table-layout: fixed;
  margin-bottom: 0;
}

.phrase-table th,
.phrase-table td {
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  text-align: left;
  word-break: break-word;
  overflow-wrap: anywhere;
  line-height: 1.15;
}

.phrase-table td {
  padding: 0.28rem 0.5rem;
  font-size: 0.88rem;
}

.phrase-table th {
  background: #fff8e0;
  color: #7a1d12;
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-transform: capitalize;
  position: sticky;
  top: 0;
  padding: 0.4rem 0.5rem;
  white-space: nowrap;
}

.phrase-table td[data-column="id"],
.phrase-table th:first-child {
  width: 88px;
  min-width: 88px;
}

.phrase-table td[data-column="category"],
.phrase-table th:nth-child(2) {
  width: 170px;
  min-width: 170px;
}

.phrase-table td[data-column="english_text"],
.phrase-table td[data-column="kannada_text"],
.phrase-table td[data-column="transliteration"],
.phrase-table th:nth-child(3),
.phrase-table th:nth-child(4),
.phrase-table th:nth-child(5) {
  width: 220px;
  min-width: 220px;
}

.phrase-table td[data-column="usage_examples"],
.phrase-table td[data-column="cultural_context"],
.phrase-table th:nth-child(6),
.phrase-table th:nth-child(7) {
  width: 250px;
  min-width: 250px;
}

.phrase-table td[data-column="is_active"],
.phrase-table th:nth-child(8) {
  width: 120px;
  min-width: 120px;
}

.phrase-table .action-header {
  width: 190px;
  min-width: 190px;
}

.phrase-table input,
.phrase-table select,
.phrase-table textarea {
  min-width: 100%;
  padding: 0.3rem 0.45rem;
  font-size: 0.86rem;
}

.table-top-scroll::-webkit-scrollbar,
.table-wrap::-webkit-scrollbar {
  height: 8px;
}

.table-top-scroll::-webkit-scrollbar-thumb,
.table-wrap::-webkit-scrollbar-thumb {
  background: #d1b680;
  border-radius: 999px;
}

.action-cell {
  min-width: 170px;
  width: 190px;
  background: #fffdf7;
  position: sticky;
  right: 0;
  z-index: 2;
  box-shadow: -10px 0 14px rgba(255, 253, 247, 0.92);
}

.action-cell .button,
.action-cell .text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.action-cell .button {
  min-width: 84px;
  padding: 0.28rem 0.55rem;
  font-size: 0.82rem;
}

.action-cell .text-button {
  margin-left: 0.65rem;
  font-size: 0.8rem;
}

.phrase-table tbody td:last-child {
  position: sticky;
  right: 0;
  background: #fffdf7;
  z-index: 2;
  box-shadow: -10px 0 14px rgba(255, 253, 247, 0.92);
}

.row-message {
  margin: 0.25rem 0 0;
  font-size: 0.76rem;
}

.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.page-label {
  color: var(--muted);
  font-weight: 600;
}

.page-numbers {
  display: flex;
  justify-content: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  margin-top: 0.9rem;
}

.page-number {
  border: 1px solid #d2c7ac;
  background: #fff;
  color: var(--text);
  border-radius: 10px;
  padding: 0.32rem 0.62rem;
  font: inherit;
  line-height: 1;
  cursor: pointer;
}

.page-number.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.page-number:disabled {
  cursor: default;
  opacity: 1;
}

.health-layout {
  display: grid;
  gap: 1.25rem;
}

.health-hero {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at top right, rgba(244, 197, 66, 0.32), transparent 28%),
    radial-gradient(circle at 18% 24%, rgba(178, 34, 34, 0.08), transparent 26%),
    linear-gradient(145deg, #fff6d7 0%, #fff1c8 34%, #fffdf7 68%, #ffffff 100%);
}

.health-hero::after {
  content: "";
  position: absolute;
  inset: auto -6% -36px auto;
  width: 180px;
  height: 180px;
  border-radius: 36px;
  transform: rotate(22deg);
  background: linear-gradient(180deg, rgba(178, 34, 34, 0.1) 0%, rgba(244, 197, 66, 0.2) 100%);
}

.health-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
}

.health-overview {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  gap: 1rem;
  align-items: center;
}

.health-status-panel {
  display: grid;
  gap: 0.6rem;
  align-content: start;
}

.health-status-pulse {
  width: 0.9rem;
  height: 0.9rem;
  border-radius: 50%;
  box-shadow: 0 0 0 0 currentColor;
  animation: health-pulse 2s ease-out infinite;
}

.health-status-pulse.success {
  color: #167c3d;
  background: #167c3d;
}

.health-status-pulse.error {
  color: #b42318;
  background: #b42318;
}

.health-status-pulse.neutral {
  color: #765b21;
  background: #765b21;
}

.health-service-title {
  margin: 0;
  font-size: clamp(1.45rem, 3vw, 2rem);
  font-weight: 700;
  line-height: 1.15;
}

.health-service-meta {
  margin-top: -0.05rem;
}

.health-status-copy {
  margin: 0.1rem 0 0;
  max-width: 32rem;
  color: #3f3b32;
}

.health-badge {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  gap: 0.45rem;
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.health-badge.success {
  background: #e8f7ee;
  color: #167c3d;
}

.health-badge.error {
  background: #fdecea;
  color: #b42318;
}

.health-badge.neutral {
  background: #f4efe0;
  color: #765b21;
}

.health-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
  margin: 0;
  padding: 1rem;
  border-radius: 20px;
  border: 1px solid rgba(178, 34, 34, 0.09);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, #fffaf0 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.health-fact {
  padding: 0.95rem 1rem;
  border-radius: 16px;
  background: #fff;
  border: 1px solid rgba(178, 34, 34, 0.08);
}

.health-facts dt {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.health-facts dd {
  margin: 0.18rem 0 0;
  font-size: 1rem;
  font-weight: 700;
}

.health-list {
  display: grid;
  gap: 0.85rem;
}

.health-list-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.05rem;
  border: 1px solid rgba(178, 34, 34, 0.08);
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff 0%, #fffdf7 100%);
  box-shadow: 0 12px 26px rgba(79, 56, 18, 0.05);
}

.health-list-item h3 {
  margin-bottom: 0.25rem;
  font-size: 1rem;
  color: var(--text);
}

.health-check-copy {
  display: grid;
  gap: 0.1rem;
}

.health-check-kicker {
  margin: 0 0 0.1rem;
  color: #8d5e18;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.health-check-detail {
  max-width: 34rem;
}

.health-check-side {
  display: grid;
  justify-items: end;
  gap: 0.6rem;
  min-width: 140px;
}

.health-check-rail {
  width: 120px;
  height: 8px;
  border-radius: 999px;
  background: #f1e7d3;
  overflow: hidden;
}

.health-check-fill {
  display: block;
  height: 100%;
  transform-origin: left center;
  animation: health-fill 800ms ease forwards;
}

.health-check-fill.success {
  width: 100%;
  background: linear-gradient(90deg, #167c3d 0%, #5cc884 100%);
}

.health-check-fill.error {
  width: 42%;
  background: linear-gradient(90deg, #b42318 0%, #ef7466 100%);
}

.health-check-fill.neutral {
  width: 64%;
  background: linear-gradient(90deg, #765b21 0%, #ddbe71 100%);
}

.health-list-item[data-tone="error"] {
  background: linear-gradient(180deg, #fff8f7 0%, #fffdf7 100%);
}

.health-stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
}

.health-stat {
  position: relative;
  overflow: hidden;
  padding: 1rem;
  border-radius: 20px;
  border: 1px solid rgba(178, 34, 34, 0.08);
  background: linear-gradient(180deg, #ffffff 0%, #fffaf0 100%);
  box-shadow: 0 16px 30px rgba(79, 56, 18, 0.06);
}

.health-stat-label {
  margin: 0 0 0.45rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.health-stat-value {
  display: block;
  font-size: clamp(1.4rem, 3vw, 2rem);
  line-height: 1;
  color: var(--primary);
}

.health-stat-mark {
  position: absolute;
  right: -14px;
  bottom: -18px;
  width: 86px;
  height: 86px;
  border-radius: 28px;
  transform: rotate(18deg);
  background: linear-gradient(180deg, rgba(244, 197, 66, 0.42) 0%, rgba(178, 34, 34, 0.14) 100%);
}

.health-summary-copy {
  margin: 0;
  font-size: 1rem;
}

.health-summary-line {
  display: flex;
  gap: 0.45rem;
  margin-top: 1rem;
}

.health-summary-marker {
  flex: 1 1 0;
  height: 0.55rem;
  border-radius: 999px;
}

.health-summary-marker.success {
  background: linear-gradient(90deg, #167c3d 0%, #5cc884 100%);
}

.health-summary-marker.error {
  background: linear-gradient(90deg, #b42318 0%, #ef7466 100%);
}

.health-summary-marker.neutral {
  background: linear-gradient(90deg, #765b21 0%, #ddbe71 100%);
}

@keyframes health-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(0, 0, 0, 0.18);
  }

  70% {
    box-shadow: 0 0 0 12px rgba(0, 0, 0, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(0, 0, 0, 0);
  }
}

@keyframes health-fill {
  0% {
    transform: scaleX(0);
  }

  100% {
    transform: scaleX(1);
  }
}

@media (max-width: 640px) {
  .section {
    padding: 2rem 0;
  }

  .card,
  .policy {
    padding: 1.1rem 1rem;
  }

  .nav-wrap {
    align-items: flex-start;
    flex-direction: column;
  }

  .footer-wrap {
    flex-direction: column;
    align-items: flex-start;
  }

  .auth-card {
    padding: 1.35rem;
    border-radius: 18px;
  }

  .toolbar {
    align-items: stretch;
  }

  .toolbar-actions {
    width: 100%;
  }

  .toolbar-actions > * {
    flex: 1 1 100%;
  }

  .toolbar-note {
    order: 2;
  }

  .health-grid,
  .health-overview,
  .health-stat-grid,
  .health-facts {
    grid-template-columns: 1fr;
  }

  .health-list-item {
    flex-direction: column;
  }

  .health-check-side {
    width: 100%;
    justify-items: start;
  }

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

  .admin-page-container {
    width: min(100% - 0.5rem, 1700px);
  }
}

@media (max-width: 960px) {
  .container {
    width: min(100% - 1rem, var(--max-width));
  }

  .admin-page-container {
    width: min(100% - 0.75rem, 1700px);
  }

  .card,
  .policy {
    padding: 1rem 0.85rem;
  }

  .health-grid,
  .health-overview {
    grid-template-columns: 1fr;
  }

  .phrase-table {
    min-width: 920px;
  }

  .phrase-table th,
  .phrase-table td {
    padding: 0.26rem 0.42rem;
  }

  .action-cell {
    min-width: 150px;
    width: 170px;
  }
}
