:root {
  --bg: #000000;
  --bg-2: #050505;
  --card: #080808;
  --card-2: #0f0f0f;
  --paper: #ffffff;
  --text: #ffffff;
  --muted: #b8b8b8;
  --muted-2: #777777;
  --line: rgba(255, 255, 255, 0.14);
  --line-strong: rgba(255, 255, 255, 0.26);
  --black-line: #111111;
  --white: #ffffff;
  --black: #000000;
  --danger: #ffffff;
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.72);
  --max: 1420px;
}

* {
  box-sizing: border-box;
}

html {
  width: 100%;
  min-height: 100%;
  background: #000;
  color-scheme: dark;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  width: 100%;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at top left, rgba(255,255,255,.08), transparent 34rem),
    radial-gradient(circle at 90% 10%, rgba(255,255,255,.04), transparent 28rem),
    #000;
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, #000, transparent 82%);
}

a {
  color: inherit;
}

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

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.login-screen {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 28px;
  background: #000;
}

.login-card {
  width: min(100%, 470px);
  padding: clamp(28px, 6vw, 48px);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: linear-gradient(180deg, rgba(255,255,255,.08), rgba(255,255,255,.025));
  box-shadow: var(--shadow);
  text-align: center;
}

.eyebrow {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  gap: 8px;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .18em;
  text-transform: uppercase;
}

.eyebrow::before {
  content: "";
  width: 30px;
  height: 1px;
  background: #fff;
  opacity: .75;
}

.login-card h1,
.hero h1,
.editor-head h2,
.history h2 {
  margin: 12px 0 12px;
  letter-spacing: -.055em;
  color: #fff;
}

.login-card h1 {
  font-size: clamp(38px, 10vw, 62px);
}

.login-card p,
.hero p,
.field-help,
.note,
.empty {
  color: var(--muted);
  line-height: 1.65;
}

.login-back-site {
  display: inline-flex;
  margin: 12px auto 28px;
  color: #d9d9d9;
  text-decoration: none;
  font-weight: 700;
  font-size: 14px;
}

.login-back-site:hover {
  color: #fff;
}

.login-form {
  display: grid;
  gap: 16px;
  text-align: left;
}

label {
  display: grid;
  gap: 8px;
  color: #f4f4f4;
  font-size: 13px;
  font-weight: 800;
}

label b {
  color: #fff;
}

input,
select,
textarea {
  width: 100%;
  min-height: 48px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  outline: none;
  background: #000;
  color: #fff;
  transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
  appearance: none;
}

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

select {
  background-image: linear-gradient(45deg, transparent 50%, #fff 50%), linear-gradient(135deg, #fff 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 12px) 50%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 36px;
}

input::placeholder,
textarea::placeholder {
  color: #737373;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(255,255,255,.75);
  box-shadow: 0 0 0 4px rgba(255,255,255,.09);
  background: #030303;
}

input[readonly],
.fixed-input {
  color: #dadada;
  background: #090909;
  border-style: dashed;
}

.hint {
  color: var(--muted-2);
  text-align: center;
}

.login-error {
  min-height: 20px;
  color: #fff;
  font-weight: 800;
  text-align: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 22px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.22);
  background: #050505;
  color: #fff;
  font-weight: 900;
  letter-spacing: -.01em;
  text-decoration: none;
  transition: transform .18s ease, opacity .18s ease, background .18s ease, color .18s ease, border-color .18s ease;
  -webkit-tap-highlight-color: transparent;
}

.btn:hover {
  transform: translateY(-1px);
  border-color: rgba(255,255,255,.5);
}

.btn.primary {
  background: #fff;
  color: #000;
  border-color: #fff;
}

.btn.primary:hover {
  background: #000;
  color: #fff;
}

.btn.ghost {
  background: transparent;
  color: #fff;
}

.btn.danger {
  background: transparent;
  color: #fff;
  border-color: rgba(255,255,255,.38);
}

.btn.small {
  min-height: 38px;
  padding: 0 14px;
  font-size: 12px;
}

.btn.full {
  width: 100%;
}

.app {
  width: min(100%, 100vw);
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px clamp(16px, 3vw, 42px);
  background: rgba(0,0,0,.88);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.brand,
.paper-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand::before,
.paper-brand::before {
  content: "T";
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #fff;
  color: #000;
  font-weight: 950;
  font-size: 20px;
  letter-spacing: -.08em;
}

.brand strong,
.paper-brand strong {
  display: block;
  color: #fff;
  font-size: 16px;
  line-height: 1.05;
}

.brand small,
.paper-brand span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

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

.top-actions span {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.hero {
  width: min(100% - 32px, var(--max));
  margin: 28px auto 0;
  padding: clamp(26px, 5vw, 48px);
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(280px, .7fr);
  gap: 26px;
  align-items: end;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: linear-gradient(145deg, rgba(255,255,255,.09), rgba(255,255,255,.018) 62%, rgba(255,255,255,.05));
  box-shadow: var(--shadow);
}

.hero h1 {
  max-width: 820px;
  font-size: clamp(38px, 7vw, 82px);
  line-height: .9;
}

.hero p {
  max-width: 680px;
  margin: 0;
}

.hero-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.hero-summary div,
.resume-grid div,
.total-line,
.history-item {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(0,0,0,.45);
}

.hero-summary div {
  padding: 18px;
  min-width: 0;
}

.hero-summary span,
.resume-grid span,
.total-line span,
.paper-total span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.hero-summary strong {
  display: block;
  margin-top: 6px;
  color: #fff;
  font-size: clamp(16px, 2vw, 22px);
  overflow-wrap: anywhere;
}

.workspace {
  width: min(100% - 32px, var(--max));
  margin: 22px auto 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(390px, .74fr);
  gap: 22px;
  align-items: start;
}

.editor,
.preview-wrap,
.history {
  min-width: 0;
}

.editor,
.history {
  padding: clamp(20px, 3vw, 28px);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: linear-gradient(180deg, rgba(255,255,255,.065), rgba(255,255,255,.018));
  box-shadow: var(--shadow);
}

.editor-head,
.history-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}

.editor-head h2,
.history h2 {
  margin-bottom: 0;
  font-size: clamp(22px, 3vw, 34px);
}

fieldset {
  margin: 0 0 18px;
  padding: clamp(16px, 3vw, 22px);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(0,0,0,.36);
}

legend {
  padding: 0 10px;
  color: #fff;
  font-size: 14px;
  font-weight: 950;
  letter-spacing: .05em;
  text-transform: uppercase;
}

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

.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));
}

.field-help,
.note {
  margin: 14px 0 0;
  font-size: 13px;
}

.service-box {
  margin-top: 12px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #030303;
}

.service-box.optional {
  background: #070707;
}

.service-box h3 {
  margin: 0 0 14px;
  font-size: 16px;
  color: #fff;
}

.service-box h3 small {
  color: var(--muted-2);
  font-weight: 700;
}

.total-line {
  margin-top: 16px;
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.total-line strong {
  color: #fff;
  font-size: 26px;
  white-space: nowrap;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 18px;
}

.preview-wrap {
  position: sticky;
  top: 88px;
  display: grid;
  gap: 22px;
}

.paper {
  width: 100%;
  padding: clamp(20px, 3vw, 30px);
  color: #000;
  background: #fff;
  border: 1px solid #eee;
  border-radius: 26px;
  box-shadow: 0 22px 70px rgba(0,0,0,.65);
  overflow: hidden;
}

.paper-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  padding-bottom: 20px;
  border-bottom: 2px solid #000;
}

.paper .paper-brand::before {
  background: #000;
  color: #fff;
}

.paper .paper-brand strong,
.paper .paper-brand span,
.paper-contact span,
.paper-section p,
.paper-section small,
.paper-footer span,
.doc-title span,
.resume-grid strong,
.paper-total strong {
  color: #000;
}

.paper-contact {
  display: grid;
  gap: 6px;
  text-align: right;
  font-size: 12px;
  color: #000;
}

.doc-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin: 22px 0;
}

.doc-title h2 {
  margin: 0;
  color: #000;
  font-size: clamp(26px, 4vw, 40px);
  text-transform: uppercase;
  letter-spacing: -.04em;
}

.doc-title div {
  display: grid;
  gap: 6px;
  text-align: right;
  font-size: 13px;
}

.paper-section {
  margin: 0 0 16px;
  padding: 16px;
  border: 1px solid #d8d8d8;
  border-radius: 16px;
  background: #fff;
}

.paper-section h3 {
  margin: 0 0 8px;
  color: #000;
  font-size: 12px;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.paper-section p {
  margin: 0 0 4px;
  font-size: 18px;
  font-weight: 900;
}

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

.resume-grid div {
  padding: 14px;
  background: #f7f7f7;
  border-color: #d8d8d8;
}

.resume-grid span {
  color: #555;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 680px;
  font-size: 12px;
}

th,
td {
  padding: 10px 8px;
  border-bottom: 1px solid #ddd;
  color: #000;
  text-align: left;
  vertical-align: top;
}

th {
  background: #000;
  color: #fff;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.paper-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 18px;
  padding: 18px;
  background: #000;
  border-radius: 18px;
}

.paper-total span,
.paper-total strong {
  color: #fff;
}

.paper-total strong {
  font-size: 28px;
}

.paper-footer {
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid #ddd;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: #000;
  font-size: 12px;
}

.history {
  padding: 22px;
}

.history-list {
  display: grid;
  gap: 10px;
}

.history-item {
  padding: 14px;
  display: grid;
  gap: 4px;
}

.history-item strong {
  color: #fff;
}

.history-item span {
  color: var(--muted);
  font-size: 12px;
}

.history-item button {
  width: fit-content;
  margin-top: 6px;
}

.footer {
  width: min(100% - 32px, var(--max));
  margin: 24px auto 0;
  padding: 28px 16px 36px;
  color: #777;
  text-align: center;
  font-size: 13px;
}

@media (max-width: 1180px) {
  .hero,
  .workspace {
    grid-template-columns: 1fr;
  }

  .preview-wrap {
    position: static;
  }

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

@media (max-width: 820px) {
  body {
    background: #000;
  }

  .topbar {
    position: relative;
    align-items: flex-start;
    flex-direction: column;
    padding: 14px 16px;
  }

  .top-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .top-actions span {
    display: none;
  }

  .hero,
  .workspace,
  .footer {
    width: min(100% - 24px, var(--max));
  }

  .hero {
    margin-top: 14px;
    padding: 24px 18px;
    border-radius: 22px;
  }

  .hero h1 {
    font-size: clamp(36px, 12vw, 54px);
  }

  .hero-summary {
    grid-template-columns: 1fr;
  }

  .editor-head,
  .history-head,
  .paper-head,
  .doc-title,
  .paper-footer,
  .total-line {
    align-items: stretch;
    flex-direction: column;
  }

  .doc-title div,
  .paper-contact {
    text-align: left;
  }

  .grid.two,
  .grid.three,
  .grid.four,
  .resume-grid {
    grid-template-columns: 1fr;
  }

  fieldset,
  .service-box,
  .paper,
  .editor,
  .history {
    border-radius: 18px;
  }

  .actions .btn,
  .top-actions .btn {
    width: 100%;
  }

  .back-site {
    order: 3;
  }

  .paper-total strong,
  .total-line strong {
    font-size: 24px;
  }
}

@media (max-width: 480px) {
  .login-screen {
    padding: 16px;
  }

  .login-card {
    padding: 26px 18px;
    border-radius: 22px;
  }

  .hero,
  .workspace,
  .footer {
    width: min(100% - 18px, var(--max));
  }

  .editor,
  .history,
  .paper {
    padding: 16px;
  }

  fieldset {
    padding: 14px;
  }

  .brand::before,
  .paper-brand::before {
    width: 38px;
    height: 38px;
  }

  input,
  select,
  textarea,
  .btn {
    min-height: 46px;
  }
}

@media print {
  @page {
    size: A4;
    margin: 12mm;
  }

  html,
  body {
    background: #fff !important;
    color: #000 !important;
  }

  body::before,
  .topbar,
  .hero,
  .editor,
  .history,
  .footer,
  .actions,
  .note {
    display: none !important;
  }

  .app,
  .workspace,
  .preview-wrap {
    display: block !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .paper {
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    color: #000 !important;
  }

  .table-wrap {
    overflow: visible !important;
  }

  table {
    min-width: 0 !important;
    font-size: 10px !important;
  }
}
