:root {
  --ink: #111111;
  --muted: #6f6b64;
  --paper: #f7f3ed;
  --panel: #fffaf3;
  --panel-strong: #ffffff;
  --line: rgba(17, 17, 17, 0.1);
  --gold: #b08a46;
  --gold-dark: #7d6130;
  --charcoal: #1d1d1b;
  --danger: #b5533c;
  --success: #54765a;
  --shadow: 0 24px 70px rgba(17, 17, 17, 0.12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at top right, rgba(176, 138, 70, 0.18), transparent 34rem),
    linear-gradient(135deg, #faf7f1 0%, #eee6d9 100%);
}

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

.app-shell { min-height: 100vh; }

.hero {
  position: relative;
  overflow: hidden;
  color: #fff;
  background:
    linear-gradient(115deg, rgba(17, 17, 17, 0.96), rgba(17, 17, 17, 0.7)),
    radial-gradient(circle at 82% 18%, rgba(176, 138, 70, 0.56), transparent 20rem),
    var(--charcoal);
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto -8rem -18rem auto;
  width: 34rem;
  height: 34rem;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 50%;
}

.topbar,
.hero-content,
.workspace {
  width: min(1480px, calc(100% - 48px));
  margin: 0 auto;
}

.topbar {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 28px 0;
}

.brand {
  color: #fff;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 16px;
  letter-spacing: .08em;
  text-transform: uppercase;
  font-weight: 700;
  line-height: 1.1;
}

.brand-logo {
  display: block;
  width: 150px;
  height: auto;
  object-fit: contain;
}

.brand-divider {
  width: 1px;
  height: 36px;
  background: rgba(255,255,255,.28);
}

.brand-text { font-size: 12px; }

.hero-content {
  position: relative;
  z-index: 1;
  padding: 64px 0 92px;
}

.eyebrow {
  margin: 0 0 20px;
  color: var(--gold);
  letter-spacing: .2em;
  text-transform: uppercase;
  font-size: 13px;
  font-weight: 700;
}

h1 {
  max-width: 840px;
  margin: 0;
  font-size: clamp(44px, 7vw, 96px);
  line-height: .94;
  letter-spacing: -.06em;
}

.hero-copy {
  max-width: 720px;
  margin: 28px 0 0;
  color: rgba(255,255,255,.74);
  font-size: clamp(17px, 2vw, 22px);
  line-height: 1.55;
}

.workspace {
  margin-top: -42px;
  padding-bottom: 56px;
  position: relative;
  z-index: 2;
}

.control-panel,
.status-grid,
.editor-card {
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.control-panel {
  display: grid;
  grid-template-columns: minmax(180px, 260px) minmax(260px, 1fr) auto;
  align-items: end;
  gap: 16px;
  padding: 18px;
  background: rgba(255,250,243,.92);
  backdrop-filter: blur(18px);
  border-radius: 24px;
}

.toolbar { display: flex; gap: 12px; align-items: end; }

.field { display: grid; gap: 8px; color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.field.compact { color: rgba(255,255,255,.72); }

select,
input[type="search"] {
  width: 100%;
  min-height: 48px;
  border: 1px solid rgba(17,17,17,.14);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  padding: 0 18px;
  outline: none;
}

.field.compact select {
  min-height: 40px;
  background: rgba(255,255,255,.12);
  color: #fff;
  border-color: rgba(255,255,255,.24);
}
.field.compact option { color: var(--ink); }

.toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  color: var(--muted);
  white-space: nowrap;
  font-weight: 650;
}

.toggle input { accent-color: var(--gold); width: 18px; height: 18px; }

.button {
  min-height: 48px;
  border: 0;
  border-radius: 999px;
  padding: 0 24px;
  font-weight: 800;
  cursor: pointer;
  transition: transform .18s ease, opacity .18s ease, background .18s ease;
}
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:disabled { opacity: .45; cursor: not-allowed; }
.button.primary { background: var(--gold); color: #fff; }
.button.primary:hover:not(:disabled) { background: var(--gold-dark); }
.button.ghost {
  min-height: 40px;
  border: 1px solid rgba(255,255,255,.24);
  background: rgba(255,255,255,.1);
  color: #fff;
}

.header-save {
  min-height: 36px;
  padding: 0 18px;
  box-shadow: none;
  white-space: nowrap;
}

.translation-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  overflow: hidden;
  margin: 22px 0;
  border-radius: 22px;
  background: var(--line);
}

.stat-card {
  background: var(--panel-strong);
  padding: 22px;
}
.stat-card span {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.stat-card strong { font-size: 34px; letter-spacing: -.04em; }
.stat-card.warning strong { color: var(--danger); }
.stat-card.changed strong { color: var(--gold-dark); }

.editor-card {
  overflow: hidden;
  border-radius: 24px;
  background: var(--panel-strong);
}

.table-header,
.entry-row {
  display: grid;
  grid-template-columns: minmax(170px, .75fr) minmax(280px, 1.2fr) minmax(320px, 1.4fr);
  gap: 0;
}

.table-header {
  position: sticky;
  top: 0;
  z-index: 4;
  background: var(--charcoal);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .11em;
  text-transform: uppercase;
}
.table-header > div { padding: 16px 18px; border-right: 1px solid rgba(255,255,255,.12); }

.entries { max-height: calc(100vh - 260px); overflow: auto; }

.entry-row {
  border-top: 1px solid var(--line);
  background: #fff;
}
.entry-row.changed { background: #fff9ec; }
.entry-row.missing textarea { border-color: rgba(181,83,60,.42); box-shadow: inset 4px 0 0 rgba(181,83,60,.65); }

.cell { padding: 16px 18px; border-right: 1px solid var(--line); min-width: 0; }
.key-cell code {
  display: block;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--gold-dark);
  font-size: 13px;
}

.section-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  margin-bottom: 8px;
  padding: 2px 9px;
  border-radius: 999px;
  background: rgba(176, 138, 70, 0.13);
  color: var(--gold-dark);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .07em;
  text-transform: uppercase;
}

.source-text {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.55;
  color: #2b2b2b;
}

.translation-cell { padding: 10px; }
textarea {
  display: block;
  width: 100%;
  min-height: 86px;
  resize: vertical;
  border: 1px solid rgba(17,17,17,.12);
  border-radius: 16px;
  padding: 13px 14px;
  outline: none;
  background: #fff;
  line-height: 1.5;
}
textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(176,138,70,.16); }

.empty-state { padding: 42px; text-align: center; color: var(--muted); }

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 10;
  max-width: 420px;
  padding: 14px 18px;
  border-radius: 16px;
  color: #fff;
  background: var(--charcoal);
  box-shadow: var(--shadow);
  transform: translateY(120%);
  opacity: 0;
  transition: .24s ease;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast.error { background: var(--danger); }
.toast.success { background: var(--success); }

@media (max-width: 1020px) {
  .control-panel { grid-template-columns: 1fr 1fr; }
  .status-grid { grid-template-columns: repeat(2, 1fr); }
  .table-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  .table-header > div:not(.translation-header) { display: none; }
  .translation-header { width: 100%; }
  .entry-row { grid-template-columns: 1fr; }
  .cell { border-right: 0; }
  .entries { max-height: none; }
}

@media (max-width: 640px) {
  .topbar, .hero-content, .workspace { width: min(100% - 28px, 1480px); }
  .topbar { align-items: flex-start; flex-direction: column; }
  .brand-logo { width: 128px; }
  .hero-content { padding: 44px 0 72px; }
  .control-panel, .status-grid { grid-template-columns: 1fr; }
  .search-field { grid-column: auto; }
  .translation-header {
    flex-direction: column;
    align-items: stretch;
  }
  .header-save { width: 100%; }
}

.login-page {
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(115deg, rgba(17, 17, 17, 0.96), rgba(17, 17, 17, 0.72)),
    radial-gradient(circle at 78% 18%, rgba(176, 138, 70, 0.56), transparent 22rem),
    var(--charcoal);
}

.login-shell {
  width: min(100%, 460px);
}

.login-card {
  padding: 42px;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 28px;
  background: rgba(255,250,243,.96);
  box-shadow: var(--shadow);
}

.login-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 32px;
}

.login-logo {
  display: block;
  width: 160px;
  filter: invert(1);
}

.login-language {
  min-width: 130px;
}

.login-language select {
  min-height: 40px;
}

.login-card h1 {
  color: var(--ink);
  font-size: 42px;
  line-height: 1;
}

.login-card p {
  margin: 14px 0 28px;
  color: var(--muted);
}

.login-form {
  display: grid;
  gap: 18px;
}

.login-form input {
  width: 100%;
  min-height: 48px;
  border: 1px solid rgba(17,17,17,.14);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  padding: 0 18px;
  outline: none;
}

.login-error {
  min-height: 22px;
  color: var(--danger);
  font-weight: 700;
}

@media (max-width: 520px) {
  .login-card { padding: 30px; }
  .login-header { flex-direction: column; }
  .login-language { width: 100%; }
}
