:root {
    --bg: #f4f5f7;
    --surface: #ffffff;
    --surface-2: #f7f7f8;
    --sidebar: #eeeff2;
    --border: #d9dbe0;
    --border-soft: #e7e8ec;
    --text: #1d1f24;
    --muted: #6b7079;
    --accent: #2f6fde;
    --accent-dark: #2459b8;
    --accent-soft: #e6eefc;
    --selected: #2f6fde;
    --selected-text: #ffffff;
    --fuzzy: #c27c0e;
    --fuzzy-soft: #fff4dd;
    --error: #d1342f;
    --error-soft: #fde8e7;
    --ok: #2e8b57;
    --ok-soft: #e4f4ea;
    --radius: 8px;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", Ubuntu, Cantarell, sans-serif;
    --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    --list-height: 52%;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.45;
    color: var(--text);
    background: var(--bg);
}
body.full { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 16px; margin: 0 0 12px; }
h3 { font-size: 12px; margin: 0 0 6px; }
code, kbd, pre { font-family: var(--mono); font-size: 12px; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.spacer { flex: 1; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Top bar ---------- */
.topbar {
    display: flex; align-items: center; gap: 16px;
    height: 48px; padding: 0 16px;
    background: #24272e; color: #fff;
    flex-shrink: 0;
}
.brand { display: flex; align-items: center; gap: 8px; color: #fff; font-weight: 600; font-size: 15px; }
.brand:hover { text-decoration: none; }
.topnav { display: flex; gap: 4px; }
.topnav a { color: #c9ccd3; padding: 6px 10px; border-radius: 6px; }
.topnav a:hover { background: #343841; color: #fff; text-decoration: none; }
.langswitch { display: flex; border: 1px solid #454a55; border-radius: 6px; overflow: hidden; }
.langswitch a { color: #c9ccd3; padding: 3px 8px; font-size: 12px; text-transform: uppercase; }
.langswitch a.active { background: #454a55; color: #fff; }
.langswitch a:hover { text-decoration: none; color: #fff; }

.usermenu { position: relative; }
.usermenu summary { list-style: none; cursor: pointer; }
.usermenu summary::-webkit-details-marker { display: none; }
.avatar {
    display: inline-flex; align-items: center; justify-content: center;
    width: 28px; height: 28px; border-radius: 50%;
    background: var(--accent); color: #fff; font-weight: 600; font-size: 13px; text-transform: uppercase;
}
.avatar-sm { width: 22px; height: 22px; font-size: 11px; vertical-align: middle; }
.avatars { display: flex; gap: 6px; flex-wrap: wrap; }
.menu {
    position: absolute; right: 0; top: calc(100% + 6px); z-index: 50;
    min-width: 200px; background: var(--surface); color: var(--text);
    border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: 0 8px 24px rgba(0,0,0,.12); padding: 6px;
    display: flex; flex-direction: column;
}
.menu a, .menu .linklike { display: block; width: 100%; text-align: left; padding: 7px 10px; border-radius: 6px; color: var(--text); }
.menu a:hover, .menu .linklike:hover { background: var(--accent-soft); text-decoration: none; }
.menu form { margin: 0; }
.menu-head { padding: 6px 10px 8px; border-bottom: 1px solid var(--border-soft); margin-bottom: 4px; display: flex; flex-direction: column; }
.dropdown { position: relative; display: inline-block; }
.dropdown summary { list-style: none; }
.dropdown summary::-webkit-details-marker { display: none; }

/* ---------- Layout ---------- */
.container { max-width: 1080px; margin: 0 auto; padding: 24px 20px 40px; }
.site-footer { text-align: center; color: var(--muted); font-size: 12px; padding: 16px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.crumbs { font-size: 12px; color: var(--muted); }
.card {
    background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius);
    padding: 18px 20px; margin-bottom: 16px;
}
.card.narrow { max-width: 480px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card-head h2 { margin: 0; }
.row-actions { display: flex; gap: 8px; align-items: center; }
.row-actions form { margin: 0; }

.tabs-nav { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.tabs-nav a { padding: 8px 14px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs-nav a.active { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.tabs-nav a:hover { text-decoration: none; color: var(--text); }

/* ---------- Alerts / toasts ---------- */
.alert { padding: 10px 14px; border-radius: var(--radius); margin-bottom: 16px; }
.alert-ok { background: var(--ok-soft); color: #1d5e39; border: 1px solid #bfe3cc; }
.alert-error { background: var(--error-soft); color: #8f1f1b; border: 1px solid #f5c2bf; }
.toast-area { position: fixed; right: 16px; bottom: 40px; z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast {
    background: #24272e; color: #fff; padding: 10px 14px; border-radius: var(--radius);
    box-shadow: 0 6px 20px rgba(0,0,0,.2); max-width: 360px; animation: toast-in .15s ease-out;
}
.toast-error { background: var(--error); }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }

/* ---------- Buttons / forms ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 7px 14px; border-radius: 6px; border: 1px solid var(--border);
    background: var(--surface); color: var(--text); font: inherit; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-danger { color: var(--error); border-color: #f0b9b6; }
.btn-danger:hover { background: var(--error-soft); }
.btn-small { padding: 4px 10px; font-size: 13px; }
.btn-block { width: 100%; }
.linklike { background: none; border: none; color: var(--accent); font: inherit; padding: 0; cursor: pointer; }
.linklike.danger, .menu .linklike.danger { color: var(--error); }

.form { display: flex; flex-direction: column; gap: 6px; }
.form label { font-weight: 600; font-size: 13px; margin-top: 8px; }
.form label.check { font-weight: normal; display: flex; gap: 8px; align-items: center; }
.form button[type=submit] { margin-top: 14px; align-self: flex-start; }
.form .btn-block[type=submit] { align-self: stretch; }
.form fieldset { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.form-inline { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; }
.form-inline button[type=submit] { margin-top: 0; }
.form-inline input { flex: 1; min-width: 200px; }
input[type=text], input[type=email], input[type=search], input:not([type]), select, textarea {
    font: inherit; padding: 7px 10px; border: 1px solid var(--border); border-radius: 6px;
    background: var(--surface); color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
textarea { resize: vertical; }

/* ---------- Auth ---------- */
.auth-card {
    max-width: 400px; margin: 48px auto; background: var(--surface);
    border: 1px solid var(--border-soft); border-radius: 12px; padding: 28px;
}
.auth-alt { text-align: center; margin: 14px 0 0; }
.username-input { display: flex; align-items: stretch; }
.username-input span { display: flex; align-items: center; padding: 0 9px; border: 1px solid var(--border); border-right: 0; border-radius: 6px 0 0 6px; background: var(--surface-2); color: var(--muted); }
.username-input input { flex: 1; border-radius: 0 6px 6px 0; min-width: 0; }
.field-help { margin: 0; }
.otp-input { font-family: var(--mono); font-size: 26px !important; letter-spacing: 10px; text-align: center; }

/* ---------- Projects ---------- */
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.project-card {
    display: flex; flex-direction: column; gap: 8px; color: var(--text);
    background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius); padding: 16px;
    transition: border-color .1s, box-shadow .1s;
}
.project-card:hover { text-decoration: none; border-color: var(--accent); box-shadow: 0 2px 10px rgba(47,111,222,.08); }
.project-card h2 { margin: 0; font-size: 15px; }
.project-card-head { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.project-card p { margin: 0; }
.project-meta { display: flex; gap: 12px; margin-top: auto; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.role-badge { font-size: 11px; padding: 2px 8px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border-soft); color: var(--muted); white-space: nowrap; }
.role-owner { background: #efe8fd; color: #5b33b5; border-color: #ddd0fb; }
.role-manager { background: var(--accent-soft); color: var(--accent-dark); border-color: #cfdcf8; }
.empty-state { text-align: center; padding: 48px 20px; }
.empty-inline { padding: 8px 0; }
.invite-banner { border-color: #cfdcf8; background: #f7faff; }
.invitation { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border-soft); }
.invitation:first-of-type { border-top: 0; }
.template-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.danger-zone { border-color: #f5c2bf; }

.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 6px 8px; border-bottom: 1px solid var(--border); }
.table td { padding: 10px 8px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .actions { text-align: right; white-space: nowrap; }
.table .actions form { display: inline; }
.table td form { margin: 0; }
.w-progress { width: 180px; }
.files-table .progress { display: inline-flex; width: 120px; vertical-align: middle; }

.progress { display: flex; height: 6px; width: 100%; background: #e2e4e9; border-radius: 3px; overflow: hidden; }
.p-done { background: var(--ok); }
.p-fuzzy { background: #e7a531; }

/* ---------- Dialogs ---------- */
.dialog {
    border: none; border-radius: 12px; padding: 22px; width: min(460px, 92vw);
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.dialog::backdrop { background: rgba(20,22,27,.45); }
.dialog h2 { margin-top: 0; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.dialog-actions button[type=submit] { margin-top: 0; }

/* ---------- Editor ---------- */
.editor-app { flex: 1; display: flex; flex-direction: column; min-height: 0; background: var(--surface); }
.toolbar {
    display: flex; align-items: center; gap: 2px; padding: 4px 10px;
    background: linear-gradient(#fafafb, #eceef1); border-bottom: 1px solid var(--border);
    flex-shrink: 0; flex-wrap: wrap;
}
.toolbar form { margin: 0; }
.tb-btn {
    display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
    min-width: 58px; padding: 4px 8px; border-radius: 6px; border: 1px solid transparent;
    background: none; color: #3b3f47; font: inherit; font-size: 11px; cursor: pointer;
}
.tb-btn:hover { background: rgba(0,0,0,.05); border-color: rgba(0,0,0,.06); text-decoration: none; }
.tb-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tb-sep { width: 1px; height: 34px; background: var(--border); margin: 0 6px; }
.tb-title { display: flex; flex-direction: column; margin: 0 16px; min-width: 0; flex: 1; }
.tb-title strong, .tb-title span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-filter { display: flex; gap: 6px; align-items: center; }
.tb-filter select, .tb-filter input { padding: 4px 8px; font-size: 13px; }
.tb-filter input[type=search] { width: 200px; }
.editor-flash { background: var(--ok-soft); color: #1d5e39; padding: 6px 14px; border-bottom: 1px solid #bfe3cc; font-size: 13px; }

.workspace { flex: 1; display: flex; min-height: 0; }
.main-col { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.list-header, .entry-row {
    display: grid; grid-template-columns: 22px minmax(0, 1fr) minmax(0, 1fr);
}
.list-header {
    font-size: 12px; color: var(--muted); font-weight: 600;
    background: var(--surface-2); border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.list-header > div { padding: 5px 8px; }
.list-header .cell-tr { border-left: 1px solid var(--border-soft); }
.entry-list { height: var(--list-height); overflow-y: auto; flex-shrink: 0; }
.entry-row { cursor: default; user-select: none; border-bottom: 1px solid #f0f1f3; }
.entry-row:nth-child(even) { background: #fafbfc; }
.entry-row > div { padding: 4px 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.entry-row .cell-tr { border-left: 1px solid #f0f1f3; }
.entry-row .cell-icon { padding: 4px 0 4px 6px; display: flex; align-items: center; }
.entry-row.st-untranslated .cell-src { font-weight: 600; }
.entry-row.st-fuzzy .cell-tr { color: var(--fuzzy); font-style: italic; }
.entry-row.has-issues .cell-tr { color: var(--error); }
.entry-row.selected, .entry-row.selected:nth-child(even) { background: var(--selected); color: var(--selected-text); }
.entry-row.selected .cell-tr, .entry-row.selected .ctx-tag { color: var(--selected-text); }
.entry-row.selected .ctx-tag { background: rgba(255,255,255,.2); }
.list-empty { padding: 24px; text-align: center; }
.mark-err {
    display: inline-flex; width: 14px; height: 14px; border-radius: 50%; background: var(--error); color: #fff;
    font-size: 10px; font-weight: 700; align-items: center; justify-content: center;
}
.mark-fuzzy { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #e7a531; }
.ctx-tag {
    display: inline-block; font-size: 11px; color: var(--muted); background: #eceef2;
    border-radius: 4px; padding: 0 5px; margin-right: 6px; font-weight: normal; font-style: normal;
}
.plural-tag { margin-left: 4px; color: var(--muted); }

.splitter { height: 5px; background: var(--surface-2); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); cursor: row-resize; flex-shrink: 0; }
.splitter:hover, .splitter.dragging { background: var(--accent-soft); }

.editor-pane { flex: 1; overflow-y: auto; min-height: 120px; transition: opacity .15s; }
.editor-pane.loading { opacity: .6; }
.editor-pane form { padding: 12px 16px; display: flex; flex-direction: column; gap: 10px; min-height: 100%; }
.editor-empty { padding: 32px; text-align: center; }
.ed-section { display: flex; flex-direction: column; gap: 6px; }
.ed-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.ed-label .ctx-tag { text-transform: none; letter-spacing: 0; }
.src-text {
    white-space: pre-wrap; word-break: break-word; font-size: 15px; padding: 8px 10px;
    background: var(--surface-2); border: 1px solid var(--border-soft); border-radius: 6px; max-height: 160px; overflow: auto;
}
.src-plural { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.src-plural .sub { font-size: 11px; color: var(--muted); }
.ed-translation { flex: 1; }
.tr-input { font-size: 15px; min-height: 90px; flex: 1; width: 100%; line-height: 1.5; }
.fuzzy-toggle { margin-left: auto; text-transform: none; letter-spacing: 0; font-weight: 600; font-size: 12px; color: var(--fuzzy); display: flex; gap: 5px; align-items: center; cursor: pointer; }
.plural-tabs { display: flex; gap: 2px; }
.ptab { border: 1px solid var(--border); border-bottom: 0; background: var(--surface-2); padding: 4px 12px; border-radius: 6px 6px 0 0; font: inherit; font-size: 12px; cursor: pointer; }
.ptab.active { background: var(--surface); font-weight: 600; }
.ed-actions { display: flex; align-items: center; gap: 10px; }
.ed-alert { padding: 8px 10px; border-radius: 6px; font-size: 13px; }
.ed-alert-error { background: var(--error-soft); color: #8f1f1b; }
.ed-alert-warn { background: var(--fuzzy-soft); color: #7a4d05; }
.ed-readonly { margin: 0; }
.draft { white-space: pre-wrap; background: #fff; padding: 6px; border-radius: 4px; margin: 4px 0 0; }
.dirty .ed-notice::after { content: "●"; color: var(--fuzzy); margin-left: 4px; }

.sidebar { width: 300px; flex-shrink: 0; background: var(--sidebar); border-left: 1px solid var(--border); overflow-y: auto; }
.sb-section { padding: 12px 14px; border-bottom: 1px solid #e0e2e7; }
.sb-section h3 { text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-size: 11px; }
.sb-text { white-space: pre-wrap; word-break: break-word; font-size: 13px; }
.sb-meta { border-bottom: 0; }
.suggestion {
    display: flex; flex-direction: column; gap: 2px; width: 100%; text-align: left; cursor: pointer;
    background: var(--surface); border: 1px solid var(--border-soft); border-radius: 6px; padding: 7px 9px; margin-bottom: 6px; font: inherit;
}
.suggestion:hover { border-color: var(--accent); }
.sugg-text { font-size: 13px; white-space: pre-wrap; word-break: break-word; }
.sugg-meta { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); gap: 6px; }
.sugg-meta kbd { background: var(--surface-2); border: 1px solid var(--border-soft); border-radius: 3px; padding: 0 4px; }
.comment-input { width: 100%; font-size: 13px; }
.refs { list-style: none; padding: 0; margin: 0; }
.refs li { padding: 1px 0; word-break: break-all; }
.flag { display: inline-block; font-size: 11px; background: var(--surface); border: 1px solid var(--border-soft); border-radius: 4px; padding: 0 6px; margin: 0 4px 4px 0; }

.statusbar {
    display: flex; align-items: center; gap: 6px; padding: 4px 12px; font-size: 12px;
    background: var(--surface-2); border-top: 1px solid var(--border); flex-shrink: 0;
}
.statusbar .progress { width: 140px; }
.sb-sep { color: var(--muted); }
.c-fuzzy { color: var(--fuzzy); }
.c-err { color: var(--error); }
.sb-shortcuts { margin-left: 12px; }

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
    .sidebar { display: none; }
    .sb-shortcuts { display: none; }
    .tb-title { flex-basis: 100%; order: 10; margin: 4px 0; }
}
@media (max-width: 700px) {
    .topnav { display: none; }
    .tb-btn span { display: none; }
    .tb-btn { min-width: 36px; }
    .tb-filter { flex-wrap: wrap; width: 100%; }
    .tb-filter input[type=search] { flex: 1; width: auto; }
    .list-header, .entry-row { grid-template-columns: 18px 1fr 1fr; }
    .page-head { flex-direction: column; }
    .files-table th:nth-child(n+3):nth-child(-n+6), .files-table td:nth-child(n+3):nth-child(-n+6) { display: none; }
    .src-plural { grid-template-columns: 1fr; }
}

/* ---------- Glossary ---------- */
.glossary-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 16px; align-items: start; }
.glossary-search { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.glossary-search input[type=search] { font-size: 16px; padding: 10px 12px; width: 100%; }
.glossary-filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.glossary-filters .check { display: flex; gap: 6px; align-items: center; font-size: 13px; }
.gl-summary { margin: 0 0 6px; }
.gl-none { padding: 24px 0; text-align: center; }
.gl-item { border-top: 1px solid var(--border-soft); }
.gl-item summary {
    display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr) auto; gap: 12px; align-items: baseline;
    padding: 9px 4px; cursor: pointer; list-style: none;
}
.gl-item summary::-webkit-details-marker { display: none; }
.gl-item summary:hover { background: var(--surface-2); }
.gl-item[open] summary { background: var(--accent-soft); }
.gl-source { font-weight: 600; word-break: break-word; }
.gl-translations { display: flex; flex-wrap: wrap; gap: 4px; }
.gl-chip { background: var(--surface-2); border: 1px solid var(--border-soft); border-radius: 4px; padding: 1px 7px; word-break: break-word; }
.gl-chip.gl-main { background: var(--ok-soft); border-color: #bfe3cc; }
.gl-inconsistent .gl-chip:not(.gl-main) { background: var(--fuzzy-soft); border-color: #f2d9a6; }
.gl-chip small { color: var(--muted); }
.gl-detail { padding: 4px 4px 14px; }
.gl-warn { color: var(--fuzzy); margin: 4px 0 8px; }
.gl-table td { vertical-align: top; }
.gl-modules code { display: inline-block; background: var(--surface-2); border-radius: 3px; padding: 0 4px; margin: 0 2px 2px 0; }
.gl-more { margin-top: 12px; }
.gl-import { display: flex; justify-content: space-between; gap: 8px; padding: 8px 0; border-top: 1px solid var(--border-soft); }
.gl-import:first-of-type { border-top: 0; }
.gl-import form { margin: 0; }
.gl-import-name { word-break: break-all; }
.glossary-side input[type=file] { max-width: 100%; }
@media (max-width: 900px) {
    .glossary-layout { grid-template-columns: 1fr; }
    .gl-item summary { grid-template-columns: 1fr; gap: 4px; }
}
.version-fields { display: grid; grid-template-columns: 1fr auto 1fr; gap: 6px; align-items: end; }
.version-fields > div { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.version-fields input { width: 100%; }
.version-dash { padding-bottom: 8px; color: var(--muted); }
.version-hint { margin: 0; }
.version-badge {
    display: inline-block; font-size: 12px; font-weight: 600; font-family: var(--mono);
    background: #efe8fd; color: #5b33b5; border-radius: 4px; padding: 0 6px; margin: 0 2px 2px 0;
}
.gl-feed { display: flex; flex-direction: column; gap: 4px; padding: 10px 0; border-top: 1px solid var(--border-soft); }
.gl-feed:first-of-type { border-top: 0; }
.gl-feed-head { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.gl-feed-url { word-break: break-all; }
.gl-feed .row-actions { margin-top: 4px; }
.feed-status { font-size: 11px; padding: 0 6px; border-radius: 8px; background: var(--surface-2); color: var(--muted); }
.feed-ok { background: var(--ok-soft); color: #1d5e39; }
.feed-err { background: var(--error-soft); color: #8f1f1b; }
.feed-error { color: var(--error); word-break: break-word; }
.gl-feed-add { margin-top: 10px; }
.gl-feed-add summary { list-style: none; display: inline-flex; }
.gl-feed-add summary::-webkit-details-marker { display: none; }
.gl-feed-add[open] summary { margin-bottom: 8px; }
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 20px 0 10px; }

/* ---------- Dialog tabs / glossary management ---------- */
.dialog-wide { width: min(760px, 94vw); max-height: 88vh; padding: 0; }
.dialog-wide > * { margin-left: 22px; margin-right: 22px; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; margin-top: 18px; }
.dialog-head h2 { margin: 0; }
.tabbar { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-top: 12px; margin-bottom: 14px; }
.tabbtn { background: none; border: none; border-bottom: 2px solid transparent; padding: 8px 14px; font: inherit; color: var(--muted); cursor: pointer; margin-bottom: -1px; }
.tabbtn.active { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.tabpanel { padding-bottom: 22px; }
.glossary-toolbar { display: flex; justify-content: flex-end; margin: -4px 0 10px; }
.source-card { border: 1px solid var(--border-soft); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 12px; }
.source-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.source-head form, .source-import form { margin: 0; }
.source-import { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 6px 0; border-top: 1px dashed var(--border-soft); }
.source-sync { border-top: 1px solid var(--border-soft); margin-top: 8px; padding-top: 8px; display: flex; flex-direction: column; gap: 4px; }
.source-sync-head { display: flex; gap: 8px; align-items: center; }
.sync-edit summary { list-style: none; cursor: pointer; }
.sync-edit summary::-webkit-details-marker { display: none; }
.sync-edit form { margin-top: 6px; }
.sync-edit input[type=url] { flex: 3; min-width: 220px; }
.lang-input { flex: 0 0 70px !important; min-width: 70px !important; }
.source-choice { border: 1px solid var(--border-soft); border-radius: 6px; padding: 8px 12px; display: flex; gap: 18px; margin-top: 8px; }
.source-choice legend { font-weight: 600; font-size: 13px; padding: 0 4px; }

/* ---------- Raw PO editor ---------- */
.raw-app { flex: 1; display: flex; flex-direction: column; min-height: 0; background: var(--surface); margin: 0; }
.raw-text {
    flex: 1; width: 100%; border: 0; border-radius: 0; resize: none; padding: 12px 16px;
    font-family: var(--mono); font-size: 13px; line-height: 1.55; tab-size: 4; white-space: pre; overflow: auto;
}
.raw-text:focus { outline: none; border: 0; }
.raw-error { background: var(--error-soft); color: #8f1f1b; padding: 8px 14px; border-bottom: 1px solid #f5c2bf; font-size: 13px; }
.raw-hint { margin: 0; padding: 4px 16px; background: var(--surface-2); border-bottom: 1px solid var(--border-soft); }
.raw-pos { margin-left: auto; padding-right: 8px; font-variant-numeric: tabular-nums; }
.dialog-medium { width: min(560px, 94vw); }
.mono { font-family: var(--mono); font-size: 12px; }
.identity-note { background: var(--accent-soft); border-radius: 6px; padding: 8px 10px; margin-top: 10px; }
.identity-preview { background: var(--surface-2); border-radius: 6px; padding: 8px 10px; margin-top: 10px; display: flex; flex-direction: column; gap: 3px; word-break: break-all; }
.form fieldset.source-choice { flex-direction: row; flex-wrap: wrap; gap: 18px; border: 1px solid var(--border-soft); padding: 8px 12px; margin-top: 8px; }
.form fieldset.source-choice label { margin-top: 0; }
.form [data-source] { display: flex; flex-direction: column; gap: 6px; }

/* ---------- AI ---------- */
.grid-2, .grid-3 { display: grid; gap: 10px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.grid-2 > div, .grid-3 > div { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
@media (max-width: 700px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }
.ai-summary { background: var(--surface-2); border-radius: 6px; padding: 10px 12px; display: flex; flex-wrap: wrap; gap: 6px 22px; font-size: 13px; }
.ai-actions { margin: 10px 0 6px; }
.tb-ai svg { stroke: #7a3fd1; }
.ai-estimate { margin-top: 8px; }
.est-table td { padding: 5px 4px; }
.est-cost td { border-top: 2px solid var(--border); font-size: 15px; }
.ai-job { padding: 8px 14px; border-bottom: 1px solid var(--border); background: #f6f1ff; }
.ai-job-main { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.ai-progress { width: 160px; }
.ai-done { background: var(--ok-soft); }
.ai-failed { background: var(--error-soft); }
.ai-cancelled { background: var(--surface-2); }

/* ---------- Machine translation origin ---------- */
.mark-ai { width: 15px; height: 15px; fill: none; stroke: #e8780c; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; vertical-align: -2px; }
.mark-ai .eye { fill: #e8780c; stroke: none; }
.mark-ai.is-fuzzy rect { fill: #fff1e0; }
.entry-row.selected .mark-ai { stroke: #fff; }
.entry-row.selected .mark-ai .eye { fill: #fff; }
.entry-row.selected .mark-ai.is-fuzzy rect { fill: rgba(255,255,255,.2); }
.c-ai { color: #c2620a; display: inline-flex; align-items: center; gap: 3px; }
.ed-alert-ai { background: #fff1e0; color: #8a4204; display: flex; align-items: center; gap: 6px; }
.origin-tag { text-transform: none; letter-spacing: 0; font-weight: 600; font-size: 11px; background: var(--surface-2); border: 1px solid var(--border-soft); color: var(--muted); border-radius: 4px; padding: 0 6px; display: inline-flex; align-items: center; gap: 3px; }
.origin-ai { background: #fff1e0; border-color: #f6cf9f; color: #c2620a; }

/* ---------- Version history ---------- */
.tb-btn { position: relative; }
.tb-badge { position: absolute; top: 0; right: 6px; background: var(--accent); color: #fff; border-radius: 8px; font-size: 10px; padding: 0 5px; line-height: 15px; }
.commit-bar .form-inline { gap: 10px; }
.commit-dirty { font-weight: 600; color: var(--fuzzy); }
.discard-form { margin: 8px 0 0; }
.original-badge { background: var(--ok-soft); color: #1d5e39; border-radius: 4px; padding: 0 5px; font-weight: 600; }
.small-title { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.history-chart { width: 100%; height: 110px; display: block; }
.history-chart .grid { stroke: var(--border-soft); stroke-width: 1; vector-effect: non-scaling-stroke; }
.history-chart polyline { fill: none; stroke-width: 2; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.history-chart .line-done { stroke: var(--ok); }
.history-chart .line-fuzzy { stroke: #e7a531; stroke-dasharray: 4 3; }
.history-chart .pt { fill: #fff; stroke: var(--accent); stroke-width: 2; vector-effect: non-scaling-stroke; }
.history-chart .pt-auto { stroke: #9aa0aa; }
.history-chart .pt-restore { stroke: #7a3fd1; }
.history-chart .pt-initial { stroke: var(--ok); }
.history-chart .pt-ai { stroke: #e8780c; fill: #fff1e0; }
.chart-legend { display: flex; gap: 6px; align-items: center; }
.lg { display: inline-block; width: 14px; height: 3px; }
.lg-done { background: var(--ok); }
.lg-fuzzy { background: #e7a531; }
.history-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 16px; align-items: start; }
.history-diff-card { position: sticky; top: 12px; max-height: calc(100vh - 40px); overflow-y: auto; }
@media (max-width: 900px) { .history-layout { grid-template-columns: 1fr; } .history-diff-card { position: static; max-height: none; } }

.timeline { list-style: none; margin: 0; padding: 0 0 0 4px; position: relative; }
.timeline::before { content: ""; position: absolute; left: 13px; top: 8px; bottom: 8px; width: 2px; background: var(--border); }
.tl-item { position: relative; display: flex; gap: 12px; padding: 8px 8px 8px 0; cursor: pointer; border-radius: 6px; }
.tl-item:hover { background: var(--surface-2); }
.tl-item.selected { background: var(--accent-soft); }
.tl-node {
    position: relative; z-index: 1; flex-shrink: 0; width: 20px; height: 20px; border-radius: 50%; margin-top: 2px;
    background: #fff; border: 3px solid var(--accent); display: flex; align-items: center; justify-content: center;
}
.tl-auto .tl-node { border-color: #9aa0aa; width: 14px; height: 14px; margin: 5px 3px 0; border-width: 2px; }
.tl-restore .tl-node { border-color: #7a3fd1; }
.tl-initial .tl-node { border-color: var(--ok); }
.tl-ai .tl-node { border-color: #e8780c; background: #fff1e0; width: 22px; height: 22px; border-width: 2px; margin: 1px -1px 0; }
.tl-ai .tl-node .mark-ai { width: 13px; height: 13px; }
.tl-working .tl-node { border-style: dashed; border-color: var(--fuzzy); }
.tl-body { min-width: 0; flex: 1; }
.tl-head { display: flex; gap: 8px; align-items: baseline; justify-content: space-between; }
.tl-msg { word-break: break-word; }
.tl-kind { font-size: 11px; color: var(--muted); white-space: nowrap; }
.tl-auto .tl-msg { font-weight: 500; color: var(--muted); }
.tl-stats { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 2px; }
.tl-progress { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; color: var(--muted); }
.tl-progress .progress { width: 80px; }
.d-add { color: var(--ok); font-weight: 600; }
.d-chg { color: #b8740c; font-weight: 600; }
.d-del { color: var(--error); font-weight: 600; }

.diff-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; margin-bottom: 8px; }
.diff-head form { margin: 0; }
.diff-summary { display: flex; gap: 12px; padding: 6px 0 10px; border-bottom: 1px solid var(--border-soft); }
.diff-list { list-style: none; margin: 0; padding: 0; }
.diff-item { padding: 8px 0 8px 10px; border-bottom: 1px solid var(--border-soft); border-left: 3px solid transparent; }
.diff-added { border-left-color: var(--ok); }
.diff-changed { border-left-color: #e7a531; }
.diff-removed { border-left-color: var(--error); }
.diff-src { font-weight: 600; font-size: 13px; margin-bottom: 3px; word-break: break-word; }
.diff-old, .diff-new { font-size: 13px; padding: 2px 6px; border-radius: 4px; white-space: pre-wrap; word-break: break-word; margin-top: 2px; }
.diff-old .t + .t::before, .diff-new .t + .t::before { content: " | "; color: var(--muted); }
.diff-none { padding: 2px 6px; font-style: italic; }
.diff-old { background: var(--error-soft); color: #8f1f1b; text-decoration: line-through; text-decoration-color: rgba(143,31,27,.4); }
.diff-new { background: var(--ok-soft); color: #1d5e39; }
.glossary-toolbar { justify-content: space-between; align-items: center; gap: 12px; }
.sync-status { display: inline-flex; align-items: center; gap: 6px; }
.sync-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); display: inline-block; }
.sync-dot.sync-failed { background: var(--error); }
.sync-dot.sync-pending { background: #9aa0aa; }
.pre-sources { margin: 6px 0 4px; padding-left: 20px; display: flex; flex-direction: column; gap: 10px; }
.pre-sources li { display: flex; flex-direction: column; gap: 4px; }
.pre-sources li::marker { color: var(--muted); font-weight: 600; }
.pre-sources label { margin-top: 0 !important; }
.pre-sources .check { display: flex; align-items: center; gap: 6px; }
.d-rev { color: #1d5e39; font-weight: 600; }
.diff-reviewed { border-left-color: #2e8b57; border-left-style: dashed; }
.diff-review { display: flex; align-items: center; gap: 6px; margin: 2px 0; }
.diff-review .arrow { color: var(--muted); }
.diff-review .approved { color: #1d5e39; font-weight: 600; }
.diff-same { font-size: 13px; padding: 2px 6px; border-radius: 4px; background: var(--surface-2); white-space: pre-wrap; word-break: break-word; }
.diff-same .t + .t::before { content: " | "; color: var(--muted); }

/* Running pre-translation: animated background so it is clear work is happening */
.ai-job.ai-running {
    background: linear-gradient(110deg, #f3e8ff 0%, #fff1e0 20%, #e6eefc 40%, #f3e8ff 60%, #fff1e0 80%, #e6eefc 100%);
    background-size: 300% 100%;
    animation: ai-shimmer 4s linear infinite;
    border-bottom-color: #d9c2f7;
}
.ai-job.ai-running .ai-progress .p-done {
    background: linear-gradient(90deg, #7a3fd1, #e8780c, #7a3fd1);
    background-size: 200% 100%;
    animation: ai-shimmer 1.6s linear infinite;
}
.ai-working-bot { display: inline-flex; animation: ai-bob 1.2s ease-in-out infinite; }
.ai-working-bot .mark-ai { width: 18px; height: 18px; }
@keyframes ai-shimmer { from { background-position: 100% 0; } to { background-position: -200% 0; } }
@keyframes ai-bob { 0%, 100% { transform: translateY(0) rotate(0); } 25% { transform: translateY(-2px) rotate(-8deg); } 75% { transform: translateY(-2px) rotate(8deg); } }
@media (prefers-reduced-motion: reduce) {
    .ai-job.ai-running, .ai-job.ai-running .ai-progress .p-done, .ai-working-bot { animation: none; }
}

/* ---------- Discussions ---------- */
.thread { margin-top: 16px; background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius); padding: 16px 18px; }
.gl-thread .thread { margin-top: 10px; padding: 12px 14px; background: var(--surface-2); }
.thread-title { font-size: 15px; margin: 0 0 10px; }
.comments { list-style: none; margin: 0 0 12px; padding: 0; }
.comment { padding: 10px 0; border-top: 1px solid var(--border-soft); }
.comment:first-child { border-top: 0; }
.comment-target { background: #fffbe6; border-radius: 6px; padding-left: 8px; padding-right: 8px; }
.comment-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.comment-head .linklike { margin-left: 4px; }
.comment-body { margin: 6px 0 0 28px; word-break: break-word; line-height: 1.5; }
.comment-edit { margin: 6px 0 0 28px; display: flex; flex-direction: column; gap: 6px; }
.comment-deleted { font-style: italic; }
.mention { background: var(--accent-soft); color: var(--accent-dark); border-radius: 4px; padding: 0 3px; font-weight: 600; }
.comment-form { display: flex; flex-direction: column; gap: 8px; }
.comment-form textarea, .comment-edit textarea { width: 100%; }
.comment-form-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.mention-chips { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.chip { border: 1px solid var(--border-soft); background: var(--surface); border-radius: 10px; padding: 0 8px; font: inherit; font-size: 12px; cursor: pointer; color: var(--accent-dark); }
.chip:hover { border-color: var(--accent); }
.comment-count { font-size: 12px; color: var(--accent-dark); white-space: nowrap; }

.term-head { margin-bottom: 14px; }
.term-source { font-size: 28px; margin: 2px 0; word-break: break-word; }
.term-hash code { font-size: 11px; word-break: break-all; }
.term-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
@media (max-width: 900px) { .term-layout { grid-template-columns: 1fr; } }
.term-table td { vertical-align: middle; }
.term-main { color: #1d5e39; }
.w-share { width: 160px; }
.share-bar { display: inline-block; width: 90px; height: 6px; background: #e2e4e9; border-radius: 3px; overflow: hidden; vertical-align: middle; }
.share-bar span { display: block; height: 100%; background: var(--ok); }
.term-versions { list-style: none; margin: 0; padding: 0; }
.term-versions li { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-top: 1px solid var(--border-soft); }
.term-versions li:first-child { border-top: 0; }
.term-versions li.changed .term-version-tr { color: #8a4204; }
.term-changed { background: var(--fuzzy-soft); color: #7a4d05; border-radius: 4px; padding: 0 6px; }
.related-terms { list-style: none; margin: 0; padding: 0; }
.related-terms li { padding: 4px 0; border-top: 1px solid var(--border-soft); word-break: break-word; }
.related-terms li:first-child { border-top: 0; }

.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.seg a { padding: 4px 12px; font-size: 13px; color: var(--muted); }
.seg a.active { background: var(--accent-soft); color: var(--accent-dark); font-weight: 600; }
.seg a:hover { text-decoration: none; }
.discussion-list { list-style: none; margin: 0; padding: 0; }
.discussion-row { display: flex; flex-direction: column; gap: 2px; padding: 10px 6px; border-top: 1px solid var(--border-soft); color: var(--text); }
.discussion-list li:first-child .discussion-row { border-top: 0; }
.discussion-row:hover { background: var(--surface-2); text-decoration: none; }
.discussion-type { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.discussion-title { font-size: 15px; word-break: break-word; }
.pager { margin-top: 10px; }
.slug-input span { font-size: 13px; }
