@font-face {
  font-family: "CenturyGothicLocal";
  src: url("./fonts/centurygothic.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "CenturyGothicLocal";
  src: url("./fonts/centurygothic_bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #0b0f15;
  --card: rgba(18, 25, 36, 0.95);
  --card-2: rgba(23, 32, 46, 0.95);
  --section: rgba(8, 13, 20, 0.36);
  --input: rgba(5, 9, 14, 0.78);

  --text: #edf3fb;
  --muted: #9aa9bc;
  --muted-2: #718196;

  --border: rgba(131, 154, 184, 0.18);
  --border-strong: rgba(131, 154, 184, 0.32);

  --accent: #2aabee;
  --accent-2: #6dd3ff;

  --danger: #ff6b6b;
  --ok: #4bd18b;
  --warn: #ffd166;

  --shadow: 0 18px 50px rgba(0, 0, 0, 0.38);

  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 13px;

  --transition: 180ms ease;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "CenturyGothicLocal", "Century Gothic", Arial, sans-serif;
  background:
    radial-gradient(circle at 16% 0%, rgba(42, 171, 238, 0.24), transparent 34%),
    radial-gradient(circle at 90% 10%, rgba(109, 211, 255, 0.13), transparent 34%),
    linear-gradient(180deg, #0d1118 0%, #070b10 100%);
}

button,
input {
  font-family: "CenturyGothicLocal", "Century Gothic", Arial, sans-serif;
}

button {
  border: 0;
}

.app {
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  padding: 18px;
  padding-bottom: calc(22px + env(safe-area-inset-bottom));
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  margin-bottom: 16px;
}

.eyebrow {
  color: var(--accent-2);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 5px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 30px;
  line-height: 1.05;
  font-weight: 700;
}

h2 {
  font-size: 20px;
  line-height: 1.15;
  margin-bottom: 6px;
  font-weight: 700;
}

p {
  color: var(--muted);
  line-height: 1.45;
  font-size: 15px;
}

.card {
  background: linear-gradient(180deg, var(--card), rgba(12, 18, 27, 0.95));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
  animation: rise 180ms ease-out;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.badge {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 11px;
  font-size: 13px;
  line-height: 1;
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.04);
}

.badge-ok {
  color: var(--ok);
  border-color: rgba(75, 209, 139, 0.28);
}

.badge-bad {
  color: var(--danger);
  border-color: rgba(255, 107, 107, 0.32);
}

.badge-warn {
  color: var(--warn);
  border-color: rgba(255, 209, 102, 0.3);
}

.doc-tabs {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

@media (min-width: 720px) {
  .doc-tabs {
    grid-template-columns: repeat(2, 1fr);
  }
}

.doc-tab {
  min-height: 58px;
  cursor: pointer;
  border: 1px solid var(--border);
  color: var(--text);
  background: linear-gradient(180deg, var(--card-2), rgba(12, 18, 27, 0.95));
  border-radius: 18px;
  padding: 13px 15px;
  font-size: 19px;
  font-weight: 700;
  text-align: center;
  transition:
    transform var(--transition),
    border-color var(--transition),
    box-shadow var(--transition),
    background var(--transition);
}

.doc-tab:hover {
  transform: translateY(-1px);
  border-color: rgba(42, 171, 238, 0.48);
}

.doc-tab.active {
  border-color: rgba(42, 171, 238, 0.82);
  box-shadow:
    0 0 0 3px rgba(42, 171, 238, 0.12) inset,
    0 10px 28px rgba(42, 171, 238, 0.08);
}

.toolbar {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (min-width: 760px) {
  .toolbar {
    grid-template-columns: repeat(2, 1fr);
  }
}

.tool-card {
  border: 1px solid rgba(131, 154, 184, 0.14);
  border-radius: 18px;
  background: var(--section);
  padding: 14px;
}

.tool-label {
  color: #dce7f4;
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 10px;
}

.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.seg-btn {
  min-height: 40px;
  cursor: pointer;
  border-radius: 999px;
  padding: 0 14px;
  color: var(--text);
  background: rgba(6, 10, 15, 0.52);
  border: 1px solid var(--border);
  font-size: 14px;
  font-weight: 700;
  transition:
    border-color var(--transition),
    background var(--transition),
    transform var(--transition);
}

.seg-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(42, 171, 238, 0.48);
}

.seg-btn.active {
  border-color: rgba(42, 171, 238, 0.82);
  background: rgba(42, 171, 238, 0.13);
  box-shadow: 0 0 0 3px rgba(42, 171, 238, 0.10) inset;
}

.form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-section {
  border: 1px solid rgba(131, 154, 184, 0.14);
  border-radius: 18px;
  background: var(--section);
  padding: 14px;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #dce7f4;
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 13px;
}

.section-title::before {
  content: "";
  width: 7px;
  height: 20px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  box-shadow: 0 0 20px rgba(42, 171, 238, 0.32);
}

.section-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (min-width: 760px) {
  .section-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

@media (min-width: 760px) {
  .field-wide {
    grid-column: 1 / -1;
  }
}

.field > span {
  font-size: 15px;
  color: #dce7f4;
}

.field small {
  min-height: 18px;
  color: var(--muted);
  line-height: 1.35;
  font-size: 13px;
}

input {
  height: 48px;
  width: 100%;
  outline: none;
  color: var(--text);
  background: var(--input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 13px;
  font-size: 16px;
  transition:
    border-color var(--transition),
    box-shadow var(--transition),
    background var(--transition);
}

input::placeholder {
  color: var(--muted-2);
}

input:focus {
  border-color: rgba(42, 171, 238, 0.72);
  box-shadow: 0 0 0 3px rgba(42, 171, 238, 0.12);
  background: rgba(6, 10, 15, 0.94);
}

input.invalid {
  border-color: rgba(255, 107, 107, 0.82);
  box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.1);
}

.inline-radios {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.radio-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  cursor: pointer;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 13px;
  background: var(--input);
  transition:
    border-color var(--transition),
    background var(--transition);
}

.radio-pill:hover {
  border-color: rgba(42, 171, 238, 0.48);
}

.radio-pill input {
  width: 17px;
  height: 17px;
  accent-color: var(--accent);
}

.radio-pill span {
  font-size: 15px;
}

.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: -2px;
}

.quick-btn {
  min-height: 30px;
  cursor: pointer;
  border-radius: 999px;
  padding: 0 11px;
  color: #cfe8f8;
  background: rgba(42, 171, 238, 0.08);
  border: 1px solid rgba(42, 171, 238, 0.18);
  font-size: 13px;
  transition:
    border-color var(--transition),
    background var(--transition);
}

.quick-btn:hover {
  background: rgba(42, 171, 238, 0.14);
  border-color: rgba(42, 171, 238, 0.36);
}

.format-box {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.radios {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

@media (min-width: 760px) {
  .format-box {
    grid-template-columns: 1fr auto;
    align-items: start;
  }

  .radios {
    grid-template-columns: repeat(3, auto);
  }
}

.radios label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  cursor: pointer;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0 12px;
  background: rgba(6, 10, 15, 0.48);
  white-space: nowrap;
  transition:
    border-color var(--transition),
    background var(--transition);
}

.radios label:hover {
  border-color: rgba(42, 171, 238, 0.36);
  background: rgba(6, 10, 15, 0.65);
}

.radios input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.radios span {
  font-size: 14px;
}

.actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 16px;
}

@media (min-width: 520px) {
  .actions {
    grid-template-columns: 1fr auto;
  }
}

.btn {
  min-height: 48px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  padding: 0 16px;
  font-size: 16px;
  font-weight: 700;
  transition:
    transform var(--transition),
    border-color var(--transition),
    background var(--transition),
    opacity var(--transition);
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.btn.primary {
  color: #ffffff;
  background: linear-gradient(180deg, #2aabee, #1478b1);
  border: 1px solid rgba(109, 211, 255, 0.36);
  box-shadow: 0 12px 30px rgba(42, 171, 238, 0.18);
}

.btn.secondary {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(131, 154, 184, 0.14);
  font-weight: 400;
}

.btn.secondary:hover {
  color: var(--text);
  border-color: rgba(131, 154, 184, 0.28);
}

.status {
  min-height: 22px;
  margin-top: 12px;
  font-size: 15px;
  color: var(--muted);
}

.status.ok {
  color: var(--ok);
}

.status.error {
  color: var(--danger);
}

.saved {
  min-height: 18px;
  margin-top: 5px;
  font-size: 13px;
  color: var(--muted);
}

.error-card {
  text-align: center;
  padding: 26px 18px;
}

.error-card p {
  max-width: 520px;
  margin: 8px auto 0;
}

.error-icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  margin: 0 auto 12px;
  border-radius: 50%;
  color: #200;
  background: var(--danger);
  font-size: 28px;
  font-weight: 700;
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(3, 6, 10, 0.64);
  backdrop-filter: blur(4px);
}

.overlay-box {
  width: min(320px, 100%);
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  padding: 22px;
  text-align: center;
  background: #101722;
  color: var(--text);
  box-shadow: var(--shadow);
  font-size: 17px;
  font-weight: 700;
}

.spinner {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  margin: 0 auto 14px;
  border: 4px solid rgba(255, 255, 255, 0.18);
  border-top-color: #ffffff;
  animation: spin 800ms linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.hidden {
  display: none !important;
}

@media (max-width: 640px) {
  .app {
    padding: 14px;
    padding-bottom: 118px;
  }

  h1 {
    font-size: 28px;
  }

  .card {
    padding: 15px;
    border-radius: 19px;
  }

  .topbar {
    align-items: flex-start;
  }

  .badge {
    font-size: 12px;
    padding: 7px 10px;
  }

  .doc-tab {
    min-height: 52px;
    font-size: 18px;
  }

  .form-section {
    padding: 13px;
  }

  .actions {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom));
    z-index: 20;
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    padding: 10px;
    border: 1px solid rgba(131, 154, 184, 0.20);
    border-radius: 18px;
    background: rgba(10, 15, 22, 0.92);
    backdrop-filter: blur(10px);
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.45);
  }

  .btn.primary {
    min-height: 48px;
  }

  .btn.secondary {
    min-height: 42px;
    width: 44px;
    padding: 0;
    font-size: 0;
    border-radius: 14px;
  }

  .btn.secondary::before {
    content: "×";
    font-size: 26px;
    line-height: 1;
    color: var(--muted);
  }

  .status {
    margin-bottom: 4px;
  }
}