:root {
  --navy: #173778;
  --navy-dark: #0d2c63;
  --navy-soft: #eef3fa;
  --bg: #f5f7fb;
  --card: #ffffff;
  --text: #223247;
  --muted: #617286;
  --border: #d9e1eb;
  --border-strong: #c9d4e1;
  --success-bg: #e8f7ee;
  --success-text: #17603a;
  --success-border: #b9e3c7;
  --error-bg: #fff0f0;
  --error-text: #9f1f1f;
  --error-border: #f3c3c3;
  --info-bg: #eef4ff;
  --info-text: #173778;
  --info-border: #cddaf3;
  --shadow-soft: 0 14px 34px rgba(0, 0, 0, 0.06);
  --shadow-medium: 0 12px 30px rgba(13, 27, 61, 0.08);
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 18px;
  --transition: 0.2s ease;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  font-family: 'Inter', sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
  max-width: 100%;
  overflow-x: hidden;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

a {
  color: var(--navy);
  text-decoration: none;
  transition: var(--transition);
}

a:hover {
  text-decoration: underline;
}

.container {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  min-width: 0;
}

.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.03);
}

.brand {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 18px 0;
  min-width: 0;
}

.brand > * {
  min-width: 0;
}

.brand h1 {
  margin: 0;
  font-size: 1.5rem;
  line-height: 1.2;
}

.meta {
  color: var(--muted);
  font-size: 0.95rem;
  margin-top: 4px;
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  max-width: 100%;
  min-width: 0;
}

.nav-links > * {
  min-width: 0;
}

.nav-links a {
  padding: 8px 10px;
  border-radius: 8px;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: normal;
  word-break: break-word;
  text-align: center;
  max-width: 100%;
}

.nav-links a:hover {
  background: var(--navy-soft);
  text-decoration: none;
}

.nav-links a.active,
.nav-links a.active-help {
  background: var(--navy);
  color: #ffffff;
  font-weight: 700;
}

.hero {
  padding: 24px 0;
}

.hero-panel,
.card,
.kpi {
  background: var(--card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
  border: 1px solid rgba(217, 225, 235, 0.75);
  min-width: 0;
}

.hero-panel {
  padding: 24px;
}

.grid {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.grid > * {
  min-width: 0;
}

.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.card,
.kpi {
  padding: 22px;
}

.card h2,
.card h3,
.card h4 {
  color: var(--navy);
}

.kpi .label {
  color: var(--muted);
  font-size: 0.92rem;
}

.kpi .value {
  font-weight: 800;
  font-size: 1.6rem;
  margin-top: 6px;
  line-height: 1.2;
}

.small {
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.65;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 14px;
}

.btn,
button {
  display: inline-block;
  background: var(--navy);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 8px 18px rgba(23, 55, 120, 0.08);
  max-width: 100%;
}

.btn:hover,
button:hover {
  background: var(--navy-dark);
  text-decoration: none;
  transform: translateY(-1px);
}

.btn:disabled,
button:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-secondary {
  background: var(--navy-soft);
  color: var(--navy);
  box-shadow: none;
}

.btn-secondary:hover {
  background: #e1ebf8;
}

.table-wrap {
  overflow-x: auto;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

table {
  width: 100%;
  max-width: 100%;
  border-collapse: collapse;
  background: #fff;
  table-layout: auto;
}

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

th {
  background: #f8fafc;
  color: var(--navy);
  font-weight: 700;
}

tr:hover td {
  background: #fbfcfe;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  min-width: 0;
}

.form-grid > * {
  min-width: 0;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.form-group.full {
  grid-column: 1 / -1;
}

label {
  font-weight: 600;
  color: var(--text);
}

input,
select,
textarea {
  width: 100%;
  max-width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid #cfd8e3;
  font: inherit;
  background: #fff;
  color: var(--text);
  transition: var(--transition);
}

input::placeholder,
textarea::placeholder {
  color: #8190a3;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(23, 55, 120, 0.12);
}

textarea {
  min-height: 120px;
  resize: vertical;
}

.notice,
.message {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
}

.notice {
  background: #f7f9fc;
  border: 1px solid var(--border);
  color: var(--muted);
}

.notice.is-success {
  background: var(--success-bg);
  color: var(--success-text);
  border: 1px solid var(--success-border);
}

.notice.is-error {
  background: var(--error-bg);
  color: var(--error-text);
  border: 1px solid var(--error-border);
}

.notice.is-info {
  background: var(--info-bg);
  color: var(--info-text);
  border: 1px solid var(--info-border);
}

.message.success {
  background: var(--success-bg);
  color: var(--success-text);
  border: 1px solid var(--success-border);
}

.message.error {
  background: var(--error-bg);
  color: var(--error-text);
  border: 1px solid var(--error-border);
}

.message.notice {
  background: var(--info-bg);
  color: var(--info-text);
  border: 1px solid var(--info-border);
}

.footer {
  padding: 20px 0 28px;
  color: var(--muted);
  text-align: center;
}

.status-badge {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--navy-soft);
  color: var(--navy);
  font-size: 0.85rem;
  font-weight: 700;
}

.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 16px;
}

.auth-card {
  width: min(520px, 100%);
  min-width: 0;
  background: var(--card);
  padding: 28px;
  border-radius: var(--radius-md);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.08);
  border: 1px solid rgba(217, 225, 235, 0.75);
}

.auth-card h2 {
  margin-top: 0;
  color: var(--navy);
}

code,
pre {
  white-space: pre-wrap;
  word-break: break-word;
}

code {
  background: #f3f6fb;
  padding: 3px 6px;
  border-radius: 6px;
  font-family: Consolas, Monaco, monospace;
}

img,
iframe,
video,
canvas {
  max-width: 100%;
  height: auto;
  display: block;
}

@media (max-width: 860px) {
  .grid-2,
  .grid-3,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    position: static;
  }

  .brand {
    align-items: flex-start;
    flex-direction: column;
  }

  .nav-links {
    align-items: flex-start;
    width: 100%;
  }

  .nav-links a {
    width: 100%;
  }

  .container {
    width: min(1120px, calc(100% - 24px));
  }

  .card,
  .kpi,
  .hero-panel,
  .auth-card {
    padding: 18px;
  }
}