*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #C8963E;
  --primary-dark: #9B6F2A;
  --bg: #F5E6C8;
  --sidebar-bg: #2C1810;
  --sidebar-text: #E8C87A;
  --sidebar-active: #C8963E;
  --card-bg: #FFFDF5;
  --text: #2C1810;
  --text-muted: #8B6F4E;
  --border: #D4B896;
  --danger: #ef4444;
  --success: #10b981;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow-md: 0 4px 12px rgba(0,0,0,.10);
  --shadow-lg: 0 10px 25px rgba(0,0,0,.15);
}

body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); height: 100vh; overflow: hidden; }

/* ── LOGIN ─────────────────────────────────────────────────── */
.login-screen { display: flex; align-items: center; justify-content: center; height: 100vh; background: linear-gradient(135deg, #2C1810 0%, #5C3D2A 50%, #8B6239 100%); }
.login-card { background: var(--card-bg); border-radius: 16px; padding: 48px 40px; width: 360px; box-shadow: var(--shadow-lg); }
.login-logo { text-align: center; margin-bottom: 32px; }
.login-brand { display: inline-flex; align-items: center; gap: 2px; margin-bottom: 12px; }
.logo-i-login { width: 52px; height: 52px; flex-shrink: 0; }
.logo-rosetta-login { font-size: 30px; font-weight: 200; color: #2C1810; letter-spacing: 3px; margin-left: 6px; }
.login-logo p { color: var(--text-muted); font-size: 14px; margin-top: 4px; }

/* ── FORM FIELDS ───────────────────────────────────────────── */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 12px; font-weight: 700; color: var(--text-muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .5px; }
.field input, .field select, .field textarea { width: 100%; padding: 10px 14px; border: 1.5px solid var(--border); border-radius: var(--radius); font-size: 14px; outline: none; transition: border-color .2s; background: #fff; color: var(--text); }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--primary); }
.field textarea { resize: vertical; min-height: 72px; }

/* ── BUTTONS ───────────────────────────────────────────────── */
.btn-primary { background: var(--primary); color: #fff; border: none; padding: 10px 20px; border-radius: var(--radius); font-size: 14px; font-weight: 600; cursor: pointer; transition: background .2s; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary.full { width: 100%; padding: 12px; font-size: 15px; }
.btn-danger { background: var(--danger); color: #fff; border: none; padding: 6px 12px; border-radius: var(--radius); font-size: 13px; cursor: pointer; }
.btn-danger:hover { opacity: .85; }
.btn-secondary { background: transparent; color: var(--primary); border: 1.5px solid var(--primary); padding: 6px 12px; border-radius: var(--radius); font-size: 13px; cursor: pointer; font-weight: 600; }
.btn-secondary:hover { background: var(--primary); color: #fff; }
.btn-small { background: var(--primary); color: #fff; border: none; padding: 5px 12px; border-radius: var(--radius); font-size: 12px; font-weight: 600; cursor: pointer; }
.btn-small:hover { background: var(--primary-dark); }
.btn-back { background: var(--primary); color: #fff; border: none; padding: 8px 18px; border-radius: var(--radius); font-size: 14px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; transition: background .2s; }
.btn-back:hover { background: var(--primary-dark); text-decoration: none; }
.btn-logout { background: rgba(255,255,255,.1); color: #fff; border: none; padding: 8px 16px; border-radius: var(--radius); font-size: 13px; cursor: pointer; width: 100%; margin-top: 8px; transition: background .2s; }
.btn-logout:hover { background: rgba(255,255,255,.2); }
.btn-save-trans { background: var(--success); color: #fff; border: none; padding: 6px 14px; border-radius: var(--radius); font-size: 13px; cursor: pointer; white-space: nowrap; }
.btn-save-trans:hover { opacity: .85; }
.btn-save-trans.saved { background: #94a3b8; }

/* ── UTILS ─────────────────────────────────────────────────── */
.error-msg { color: var(--danger); font-size: 13px; padding: 8px 12px; background: #fef2f2; border-radius: var(--radius); margin-bottom: 12px; }
.hidden { display: none !important; }
.iso-badge { font-size: 11px; font-family: monospace; background: #FFE4A0; color: var(--primary); padding: 1px 6px; border-radius: 4px; font-weight: 700; }

/* ── APP LAYOUT ────────────────────────────────────────────── */
.app { display: flex; height: 100vh; overflow: hidden; }
.sidebar { width: 232px; background: var(--sidebar-bg); display: flex; flex-direction: column; flex-shrink: 0; height: 100%; position: relative; }

/* Logo */
.sidebar-logo { display: flex; align-items: center; gap: 2px; padding: 22px 18px 18px; border-bottom: 1px solid rgba(255,255,255,.08); }
.logo-i { width: 34px; height: 34px; flex-shrink: 0; }
.logo-rosetta { font-size: 19px; font-weight: 200; color: #fff; letter-spacing: 3px; margin-left: 5px; }

/* User block */
.sidebar-user { display: flex; align-items: center; gap: 11px; padding: 14px 14px 14px; margin: 10px 10px 38px; background: rgba(255,255,255,.06); border-radius: 10px; border: 1px solid rgba(255,255,255,.07); }
.user-initials-avatar { width: 38px; height: 38px; background: linear-gradient(135deg, #E8C87A 0%, #C8963E 100%); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700; color: #fff; flex-shrink: 0; text-transform: uppercase; box-shadow: 0 2px 8px rgba(200,150,62,.4); }
.user-meta { flex: 1; min-width: 0; }
.user-meta-name { color: #fff; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-meta-role { display: inline-block; background: rgba(255,255,255,.12); padding: 2px 8px; border-radius: 8px; font-size: 11px; color: var(--sidebar-text); margin-top: 4px; font-weight: 500; }

/* Nav */
nav.sidebar-nav { padding: 10px 8px; flex: 1; overflow-y: auto; min-height: 0; }
.nav-item { display: block; padding: 10px 14px; color: var(--sidebar-text); text-decoration: none; border-radius: var(--radius); font-size: 14px; font-weight: 500; transition: background .15s, color .15s; margin-bottom: 2px; cursor: pointer; }
.nav-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-item.active { background: var(--sidebar-active); color: #fff; }

/* Change pwd — normal flow, just above the fixed logout */
.sidebar-changepwd { flex-shrink: 0; padding: 12px 16px 80px; border-top: 1px solid rgba(255,255,255,.08); }

/* Esci — position absolute, always at the very bottom */
.sidebar-logout-fixed { position: absolute; bottom: 0; left: 0; right: 0; padding: 12px 16px; background: var(--sidebar-bg); border-top: 1px solid rgba(255,255,255,.06); }
.app-version { text-align: center; font-size: 11px; color: rgba(255,255,255,.22); margin-top: 6px; letter-spacing: .5px; }

/* ── MAIN ──────────────────────────────────────────────────── */
.main-content { flex: 1; overflow-y: auto; padding: 32px; }
.section h2 { font-size: 22px; font-weight: 700; color: var(--text); }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.section-header h2 { margin-bottom: 0; }
.subsection-title { font-size: 15px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; margin: 28px 0 14px; }

/* ── STATS ─────────────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; margin-bottom: 8px; }
.stat-card { background: var(--card-bg); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.stat-card .stat-value { font-size: 30px; font-weight: 700; color: var(--primary); }
.stat-card .stat-label { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

/* ── PROJECT CARDS ─────────────────────────────────────────── */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 16px; }
.project-card { background: var(--card-bg); border-radius: 12px; box-shadow: var(--shadow); border: 1px solid var(--border); overflow: hidden; transition: box-shadow .2s, transform .15s; display: flex; flex-direction: column; }
.project-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.project-card-body { padding: 20px; cursor: pointer; flex: 1; display: flex; flex-direction: column; }
.project-card-body h3 { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.project-card-body .pid { font-size: 12px; font-family: monospace; color: var(--text-muted); background: #F5EDD5; padding: 2px 7px; border-radius: 4px; display: inline-block; margin-bottom: 10px; }
.project-card-body p { font-size: 13px; color: var(--text-muted); line-height: 1.5; flex: 1; min-height: 20px; }
.project-card-meta { display: flex; gap: 12px; margin-top: 12px; }
.project-card-meta span { font-size: 12px; color: var(--text-muted); display: flex; align-items: center; gap: 4px; }
.project-card-footer { padding: 10px 20px; background: #FAF6EE; border-top: 1px solid var(--border); display: flex; gap: 8px; }

/* ── PROJECT DETAIL ────────────────────────────────────────── */
.project-detail-header { margin-bottom: 24px; }
.pd-title-block { display: flex; align-items: center; gap: 12px; margin: 10px 0 6px; }
.pd-title-block h2 { font-size: 24px; font-weight: 700; }
.pid-badge { font-size: 12px; font-family: monospace; background: #FFE4A0; color: var(--primary); padding: 3px 10px; border-radius: 6px; font-weight: 700; }
.pd-desc { font-size: 14px; color: var(--text-muted); }

.pd-languages-section { background: var(--card-bg); border-radius: var(--radius); padding: 16px 20px; box-shadow: var(--shadow); }
.pd-languages-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.pd-section-label { font-size: 12px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; }
.lang-chips { display: flex; flex-wrap: wrap; gap: 8px; min-height: 32px; align-items: center; }
.lang-chip { display: flex; flex-direction: column; align-items: center; gap: 4px; background: #F5EDD5; border: 1px solid var(--border); border-radius: 20px; padding: 7px 12px; font-size: 13px; }
.lang-chip-top { display: flex; align-items: center; gap: 6px; }
.lang-chip-pct { font-size: 15px; font-weight: 800; text-align: center; }
.lang-chip .flag { font-size: 18px; }
.lang-chip-del { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 14px; margin-left: 4px; line-height: 1; }
.lang-chip-del:hover { color: var(--danger); }
.lang-empty { color: var(--text-muted); font-size: 13px; font-style: italic; }

/* ── TERM CARDS ────────────────────────────────────────────── */
.term-card { background: var(--card-bg); border-radius: var(--radius); margin-bottom: 6px; box-shadow: var(--shadow); overflow: hidden; }
.term-card-header { display: flex; align-items: center; gap: 12px; padding: 13px 18px; cursor: pointer; user-select: none; }
.term-card-header:hover { background: #FAF6EE; }
.term-code { font-family: monospace; font-size: 14px; font-weight: 700; color: var(--primary); flex: 1; max-width: none; white-space: normal; word-break: break-all; }
.term-notes { font-size: 13px; color: var(--text-muted); flex: 2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.term-chevron { color: var(--text-muted); font-size: 11px; transition: transform .2s; flex-shrink: 0; }
.term-actions { display: flex; gap: 6px; }
.term-translations { border-top: 1px solid var(--border); display: none; }
.term-translations.open { display: block; }
.trans-table { width: 100%; border-collapse: collapse; }
.trans-table td { padding: 10px 18px; font-size: 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
.trans-table tr:last-child td { border-bottom: none; }
.lang-cell { display: flex; align-items: center; gap: 8px; white-space: nowrap; width: 180px; }
.trans-input { width: 100%; padding: 7px 10px; border: 1.5px solid var(--border); border-radius: var(--radius); font-size: 14px; outline: none; transition: border-color .2s; font-family: inherit; resize: vertical; min-height: 60px; }
.trans-input:focus { border-color: var(--primary); }
.trans-input.trans-saved { border-color: var(--success); }
.trans-status { font-size: 14px; color: var(--success); font-weight: 700; opacity: 0; transition: opacity .2s; }
.trans-status.show { opacity: 1; }

/* ── USER CARDS ────────────────────────────────────────────── */
.user-card { background: var(--card-bg); border-radius: 12px; box-shadow: var(--shadow); border: 1px solid var(--border); padding: 20px; display: flex; flex-direction: column; align-items: flex-start; }
.user-card-avatar { width: 40px; height: 40px; background: linear-gradient(135deg, #E8C87A, #C8963E); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 15px; font-weight: 700; color: #fff; margin-bottom: 12px; }
.user-card h3 { font-size: 15px; font-weight: 700; margin-bottom: 6px; }
.role-badge { display: inline-block; background: var(--primary); color: #fff; padding: 2px 10px; border-radius: 12px; font-size: 12px; font-weight: 600; margin-bottom: 10px; }
.user-card-meta { font-size: 13px; color: var(--text-muted); line-height: 1.8; }
.user-card-footer { display: flex; gap: 8px; margin-top: 14px; }

/* ── DATA TABLE (users fallback) ───────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; background: var(--card-bg); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.data-table th { background: #FAF6EE; padding: 12px 16px; text-align: left; font-size: 12px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; border-bottom: 1px solid var(--border); }
.data-table td { padding: 12px 16px; font-size: 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.table-actions { display: flex; gap: 8px; }

/* ── CHANGE PASSWORD BUTTON ────────────────────────────────── */
.btn-change-pwd { background: none; border: none; color: var(--sidebar-text); font-size: 12px; cursor: pointer; padding: 4px 0; opacity: .7; display: block; text-align: left; }
.btn-change-pwd:hover { opacity: 1; text-decoration: underline; }

/* ── LANGUAGE CATALOG TABLE (section) ──────────────────────── */
.catalog-search-input { padding: 8px 14px; border: 1.5px solid var(--border); border-radius: var(--radius); font-size: 14px; outline: none; min-width: 280px; transition: border-color .2s; }
.catalog-search-input:focus { border-color: var(--primary); }
.catalog-table-wrap { background: var(--card-bg); border-radius: 12px; box-shadow: var(--shadow); border: 1px solid var(--border); overflow: hidden; }
.catalog-table { width: 100%; border-collapse: collapse; }
.catalog-table th { background: #FAF6EE; padding: 11px 16px; text-align: left; font-size: 12px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; border-bottom: 1px solid var(--border); }
.catalog-table td { padding: 10px 16px; font-size: 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.catalog-table tr:last-child td { border-bottom: none; }
.catalog-table tr:hover td { background: #FAF6EE; }
.catalog-table .cat-flag { font-size: 22px; }
.catalog-count { font-size: 13px; color: var(--text-muted); margin-top: 8px; }

/* ── LANGUAGE CATALOG ──────────────────────────────────────── */
.lang-catalog-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; max-height: 320px; overflow-y: auto; padding: 2px; }
.lang-cat-item { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border: 1.5px solid var(--border); border-radius: 8px; cursor: pointer; transition: border-color .15s, background .15s; }
.lang-cat-item:hover { border-color: #E8C87A; background: #FFF8EC; }
.lang-cat-item.selected { border-color: var(--primary); background: #FFF3D4; }
.lang-cat-flag { font-size: 20px; flex-shrink: 0; }
.lang-cat-name { font-size: 13px; font-weight: 500; flex: 1; color: var(--text); min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── PERMISSION CHECKLIST & CHIPS ──────────────────────────── */
.perm-checklist { display: flex; flex-direction: column; gap: 4px; max-height: 260px; overflow-y: auto; border: 1.5px solid var(--border); border-radius: var(--radius); padding: 8px; }
.perm-check-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 6px; cursor: pointer; transition: background .12s; }
.perm-check-row:hover { background: #F5EDD5; }
.perm-check-row input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--primary); flex-shrink: 0; cursor: pointer; }
.perm-check-row .proj-name { font-size: 14px; font-weight: 600; color: var(--text); flex: 1; }
.perm-check-row .pid { font-size: 11px; font-family: monospace; color: var(--text-muted); background: #F5EDD5; padding: 1px 6px; border-radius: 4px; }
.proj-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.proj-chip { display: inline-flex; align-items: center; gap: 5px; background: #FFF3D4; color: #7B5530; border-radius: 14px; padding: 3px 8px 3px 10px; font-size: 12px; font-weight: 600; }
.proj-chip-del { background: none; border: none; color: #9B6F2A; cursor: pointer; font-size: 13px; line-height: 1; padding: 0 2px; opacity: .6; }
.proj-chip-del:hover { opacity: 1; color: var(--danger); }

/* ── PERMISSIONS TABLE ─────────────────────────────────────── */
.perm-filters { display: flex; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.perm-filters input, .perm-filters select { padding: 8px 12px; border: 1.5px solid var(--border); border-radius: var(--radius); font-size: 13px; background: var(--card-bg); color: var(--text); outline: none; min-width: 160px; flex: 1; }
.perm-filters input:focus, .perm-filters select:focus { border-color: var(--primary); }
#permissions-table-wrap { background: var(--card-bg); border-radius: 12px; box-shadow: var(--shadow); border: 1px solid var(--border); overflow: hidden; margin-top: 8px; }
.perm-table { width: 100%; border-collapse: collapse; }
.perm-table th { background: #FAF6EE; padding: 11px 16px; text-align: left; font-size: 12px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; border-bottom: 1px solid var(--border); }
.perm-table td { padding: 13px 16px; font-size: 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.perm-table tr:last-child td { border-bottom: none; }
.perm-table tr:hover td { background: #FAF6EE; }

/* ── ARB IMPORT ────────────────────────────────────────────── */
.arb-dropzone { border: 2.5px dashed var(--border); border-radius: 12px; padding: 48px 24px; text-align: center; cursor: pointer; transition: border-color .2s, background .2s; }
.arb-dropzone.drag-over { border-color: var(--primary); background: #FFF3D422; }
.arb-dropzone-icon { font-size: 40px; margin-bottom: 12px; }
.arb-dropzone p { font-size: 15px; color: var(--text-muted); margin-bottom: 6px; }
.arb-dropzone p strong { color: var(--text); }
.arb-dropzone code { background: #F5EDD5; padding: 1px 6px; border-radius: 4px; font-size: 13px; }
.arb-dropzone-hint { font-size: 12px !important; margin: 10px 0 14px !important; }
.arb-lang-card { display: flex; align-items: center; gap: 16px; background: linear-gradient(135deg, #FFF3D4, #FFE4A0); border-radius: 12px; padding: 20px 24px; margin-bottom: 20px; border: 1px solid #E8C87A; }
.arb-lang-flag { font-size: 48px; line-height: 1; }
.arb-lang-info { flex: 1; }
.arb-lang-info h3 { font-size: 18px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.arb-lang-info .iso-badge { font-size: 13px; }
.arb-lang-info .arb-count { font-size: 13px; color: var(--text-muted); margin-top: 6px; }
.arb-lang-unknown { background: #fef9c3; border: 1px solid #fde047; border-radius: 8px; padding: 12px 16px; font-size: 13px; color: #854d0e; margin-bottom: 16px; }
.arb-file-card { display: flex; align-items: center; gap: 12px; background: #FAF6EE; border: 1.5px solid var(--border); border-radius: var(--radius); padding: 12px 16px; margin-bottom: 16px; }
.arb-file-icon { font-size: 28px; flex-shrink: 0; }
.import-mode-group { display: flex; flex-direction: column; gap: 8px; }
.import-mode-opt { display: flex; align-items: flex-start; gap: 12px; border: 1.5px solid var(--border); border-radius: 10px; padding: 14px 16px; cursor: pointer; transition: border-color .15s, background .15s; }
.import-mode-opt:has(input:checked) { border-color: var(--primary); background: #FFF3D422; }
.import-mode-opt input[type=radio] { margin-top: 2px; accent-color: var(--primary); flex-shrink: 0; width: 16px; height: 16px; cursor: pointer; }
.import-mode-opt strong { display: block; font-size: 14px; font-weight: 700; color: var(--text); margin-bottom: 2px; }
.import-mode-opt span { font-size: 12px; color: var(--text-muted); line-height: 1.5; }
.arb-result { text-align: center; padding: 16px 0; }
.arb-result-icon { font-size: 48px; margin-bottom: 12px; }
.arb-result h3 { font-size: 18px; font-weight: 700; margin-bottom: 8px; }
.arb-result-stats { display: flex; justify-content: center; gap: 24px; margin-top: 16px; }
.arb-stat { background: #FAF6EE; border-radius: 8px; padding: 12px 20px; text-align: center; }
.arb-stat-val { font-size: 24px; font-weight: 700; color: var(--primary); }
.arb-stat-lbl { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ── MODAL ─────────────────────────────────────────────────── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); display: flex; align-items: center; justify-content: center; z-index: 1000; backdrop-filter: blur(2px); }
.modal { background: var(--card-bg); border-radius: 12px; width: 576px; max-width: 95vw; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-lg); }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; border-bottom: 1px solid var(--border); }
.modal-header h3 { font-size: 17px; font-weight: 700; }
.modal-close { background: none; border: none; font-size: 18px; cursor: pointer; color: var(--text-muted); }
.modal-body { padding: 24px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; padding-top: 16px; }

/* ── PD STATS (per-project) ────────────────────────────────── */
.pd-stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; margin: 20px 0 4px; }

/* ── TERM FILTERS ──────────────────────────────────────────── */
.term-filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; align-items: center; }
.term-filters input[type=text], .term-filters select { padding: 7px 12px; border: 1.5px solid var(--border); border-radius: var(--radius); font-size: 13px; background: var(--card-bg); color: var(--text); outline: none; transition: border-color .2s; }
.term-filters input[type=text]:focus, .term-filters select:focus { border-color: var(--primary); }
.term-filter-check { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text); cursor: pointer; white-space: nowrap; }
.term-filter-check input[type=checkbox] { accent-color: var(--primary); width: 15px; height: 15px; cursor: pointer; }

/* ── TERMS PAGINATION ──────────────────────────────────────── */
.terms-pagination { display: flex; align-items: center; gap: 8px; }
.terms-pagination .page-info { font-size: 13px; color: var(--text-muted); flex: 1; }
.terms-pagination button { padding: 5px 12px; border: 1.5px solid var(--border); border-radius: var(--radius); font-size: 13px; background: var(--card-bg); color: var(--text); cursor: pointer; transition: border-color .2s, color .2s; }
.terms-pagination button:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.terms-pagination button:disabled { opacity: .35; cursor: default; }
.terms-pagination select { padding: 5px 10px; border: 1.5px solid var(--border); border-radius: var(--radius); font-size: 13px; background: var(--card-bg); color: var(--text); cursor: pointer; outline: none; }

/* ── DASHBOARD TABS ────────────────────────────────────────── */
.dash-tabs { display: flex; gap: 2px; margin: 20px 0 0; border-bottom: 2px solid var(--border); }
.dash-tab { padding: 8px 22px; border: none; background: none; font-size: 14px; font-weight: 600; color: var(--text-muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: color .15s, border-color .15s; border-radius: 6px 6px 0 0; }
.dash-tab:hover { color: var(--text); background: rgba(0,0,0,.04); }
.dash-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
#dash-tab-projects { padding-top: 16px; }
#dash-tab-filters { padding-top: 14px; }

/* ── GLOBAL FILTER ROW ─────────────────────────────────────── */
.global-flat-row { display: flex; align-items: flex-start; gap: 12px; background: var(--card-bg); border-radius: var(--radius); margin-bottom: 4px; padding: 10px 16px; box-shadow: var(--shadow); }
.gf-proj-info { min-width: 140px; flex-shrink: 0; padding-top: 4px; }
.gf-proj-name { font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gf-proj-id { font-size: 11px; font-family: monospace; color: var(--text-muted); margin-top: 1px; }

/* ── FLAT VIEW ─────────────────────────────────────────────── */
.term-flat-row { display: flex; align-items: flex-start; gap: 12px; background: var(--card-bg); border-radius: var(--radius); margin-bottom: 4px; padding: 10px 16px; box-shadow: var(--shadow); }
.term-flat-code { font-family: monospace; font-size: 13px; font-weight: 700; color: var(--primary); width: 260px; min-width: 140px; overflow-wrap: break-word; word-break: break-all; white-space: normal; flex-shrink: 0; }
.term-flat-lang { display: flex; align-items: flex-start; gap: 6px; width: 160px; min-width: 120px; flex-shrink: 0; white-space: nowrap; font-size: 13px; padding-top: 4px; }
.term-flat-input-wrap { flex: 1; display: flex; align-items: flex-start; gap: 8px; min-width: 0; }

/* ── PROJECT TABS ──────────────────────────────────────────── */
.proj-tabs { display: flex; gap: 2px; margin: 20px 0 0; border-bottom: 2px solid var(--border); }
.proj-tab { padding: 8px 22px; border: none; background: none; font-size: 14px; font-weight: 600; color: var(--text-muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: color .15s, border-color .15s; border-radius: 6px 6px 0 0; }
.proj-tab:hover { color: var(--text); background: rgba(0,0,0,.04); }
.proj-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
#proj-tab-registry { padding-top: 16px; }
#proj-tab-filters { padding-top: 14px; }
#proj-tab-import { padding-top: 16px; }

/* ── REGISTRY TOOLBAR ──────────────────────────────────────── */
.registry-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.registry-toolbar input[type=text] { padding: 7px 12px; border: 1.5px solid var(--border); border-radius: var(--radius); font-size: 13px; outline: none; flex: 1; min-width: 200px; transition: border-color .2s; }
.registry-toolbar input[type=text]:focus { border-color: var(--primary); }

/* ── MULTI-SELECT DROPDOWN ─────────────────────────────────── */
.ms-wrap { position: relative; flex-shrink: 0; }
.ms-btn { display: flex; align-items: center; gap: 8px; padding: 7px 12px; border: 1.5px solid var(--border); border-radius: var(--radius); font-size: 13px; background: var(--card-bg); color: var(--text); cursor: pointer; min-width: 160px; transition: border-color .2s; white-space: nowrap; }
.ms-btn:hover, .ms-btn.open { border-color: var(--primary); }
.ms-arrow { color: var(--text-muted); font-size: 11px; margin-left: auto; }
.ms-dd { position: absolute; top: calc(100% + 4px); left: 0; z-index: 100; background: var(--card-bg); border: 1.5px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-md); min-width: 220px; max-height: 240px; overflow-y: auto; }
.ms-item { display: flex; align-items: center; gap: 8px; padding: 8px 12px; cursor: pointer; font-size: 13px; transition: background .1s; }
.ms-item:hover { background: #FAF6EE; }
.ms-item input[type=checkbox] { accent-color: var(--primary); width: 15px; height: 15px; flex-shrink: 0; cursor: pointer; }

/* ── BACK BUTTON PROMINENT ─────────────────────────────────── */
.btn-back { background: var(--primary); color: #fff !important; border: none; padding: 8px 18px; border-radius: var(--radius); font-size: 14px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; transition: background .2s; text-decoration: none !important; }
.btn-back:hover { background: var(--primary-dark); }

/* ── IMPORT WIZARD INLINE ──────────────────────────────────── */
.import-tab-wrap { max-width: 560px; }

/* ── TOKEN CARDS ───────────────────────────────────────────── */
.token-card { background: var(--card-bg); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; display: flex; flex-direction: column; gap: 10px; }
.token-card h3 { font-size: 15px; font-weight: 700; color: var(--text); margin: 0; }
.token-card-meta { display: flex; flex-direction: column; gap: 4px; }
.token-card-meta span { font-size: 12px; color: var(--text-muted); }
.token-preview { font-family: monospace; font-size: 13px; background: #F5EDD5; padding: 4px 10px; border-radius: 6px; color: var(--primary); display: inline-block; }
.token-card-footer { display: flex; justify-content: flex-end; margin-top: 4px; }
.token-plain-box { background: #F5EDD5; border: 1.5px solid var(--border); border-radius: var(--radius); padding: 14px 16px; margin: 12px 0; display: flex; align-items: center; gap: 10px; }
.token-plain-val { font-family: monospace; font-size: 13px; flex: 1; word-break: break-all; color: var(--text); }
.btn-copy { background: var(--primary); color: #fff; border: none; padding: 6px 14px; border-radius: var(--radius); font-size: 12px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.pid-chip { display: inline-flex; align-items: center; gap: 4px; background: #F5EDD5; border-radius: 6px; padding: 2px 8px; font-size: 12px; margin-right: 4px; }

/* ── BACKUP LIST ───────────────────────────────────────────── */
.backup-upload-form { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; padding: 14px 18px; background: var(--card-bg); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--border); max-width: 700px; }
.backup-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; max-width: 700px; }
.backup-entry { background: var(--card-bg); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 18px; display: flex; align-items: center; gap: 14px; }
.backup-entry-icon { font-size: 22px; flex-shrink: 0; }
.backup-entry-info { flex: 1; min-width: 0; }
.backup-entry-name { font-family: monospace; font-size: 12px; color: var(--text-muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.backup-entry-date { font-size: 14px; font-weight: 600; color: var(--text); }
.backup-entry-size { font-size: 12px; color: var(--text-muted); margin-left: 8px; }
.backup-empty { color: var(--text-muted); font-size: 14px; padding: 20px 0; }

/* ── LOG TABLE ─────────────────────────────────────────────── */
.log-filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; align-items: center; }
.log-filters input, .log-filters select { padding: 7px 12px; border: 1.5px solid var(--border); border-radius: var(--radius); font-size: 13px; outline: none; transition: border-color .2s; background: #fff; }
.log-filters input:focus, .log-filters select:focus { border-color: var(--primary); }
.log-table { width: 100%; border-collapse: collapse; background: var(--card-bg); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.log-table th { text-align: left; padding: 10px 14px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--text-muted); border-bottom: 1.5px solid var(--border); background: #FAF6EE; }
.log-table td { padding: 10px 14px; font-size: 13px; border-bottom: 1px solid var(--border); vertical-align: top; }
.log-table tr:last-child td { border-bottom: none; }
.log-table tr:hover td { background: #FAF6EE; }
.log-action-badge { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.log-action-create { background: #d1fae5; color: #065f46; }
.log-action-delete { background: #fee2e2; color: #991b1b; }
.log-action-import { background: #dbeafe; color: #1e40af; }
.log-action-edit { background: #fef3c7; color: #92400e; }
.log-action-lang { background: #FFF3D4; color: #7B5530; }
.log-details { font-size: 12px; color: var(--text-muted); font-family: monospace; }

/* ── SETTINGS ──────────────────────────────────────────────── */
.settings-card { background: var(--card-bg); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; margin-bottom: 20px; max-width: 640px; border: 1px solid var(--border); }
.settings-card-title { font-size: 16px; font-weight: 700; color: var(--text); margin-bottom: 6px; display: flex; align-items: center; gap: 8px; }
.settings-card-desc { font-size: 13px; color: var(--text-muted); margin-bottom: 18px; line-height: 1.5; }
.settings-card-desc code { background: #F5EDD5; padding: 1px 5px; border-radius: 4px; font-family: monospace; font-size: 12px; }
.settings-icon { font-size: 20px; }
.settings-row { display: flex; align-items: center; gap: 16px; margin-bottom: 14px; }
.settings-label { font-size: 13px; font-weight: 600; color: var(--text-secondary); min-width: 160px; }
.settings-input { flex: 1; border: 1.5px solid var(--border); border-radius: var(--radius); padding: 7px 10px; font-size: 13px; color: var(--text); background: var(--bg); }
.settings-input:focus { outline: none; border-color: var(--primary); }
.toggle-switch { position: relative; width: 44px; height: 24px; display: inline-block; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; cursor: pointer; inset: 0; background: #cbd5e1; border-radius: 24px; transition: .2s; }
.toggle-slider:before { content: ''; position: absolute; height: 18px; width: 18px; left: 3px; bottom: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.toggle-switch input:checked + .toggle-slider { background: var(--primary); }
.toggle-switch input:checked + .toggle-slider:before { transform: translateX(20px); }
.aws-status-badge { font-size: 13px; font-weight: 600; padding: 3px 10px; border-radius: 6px; }
.aws-ok { background: #dcfce7; color: #166534; }
.aws-no { background: #F5EDD5; color: var(--text-muted); }

/* ── TRANSLATE BUTTON ──────────────────────────────────────── */
.btn-libre { background: none; border: 1.5px solid #9B6F2A; color: #9B6F2A; border-radius: 6px; width: 28px; height: 28px; font-size: 14px; cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0; transition: background .15s; }
.btn-libre:hover:not(:disabled) { background: #FFF3D4; }
.btn-libre:disabled { opacity: .4; cursor: default; }

/* ── S3 BADGE ─────────────────────────────────────────────── */
.s3-badge { display: inline-flex; align-items: center; gap: 3px; background: #fef3c7; color: #92400e; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 5px; margin-left: 8px; }
.backup-days-grid { display: flex; gap: 8px; flex-wrap: wrap; }
.day-check { display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer; }
.day-check input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }
.day-check span { font-size: 11px; font-weight: 600; color: var(--text-secondary); }

/* ── IMPORT PROGRESS BAR ───────────────────────────────────── */
.import-progress-wrap { padding: 24px 8px; display: flex; flex-direction: column; align-items: center; gap: 14px; min-height: 120px; justify-content: center; }
.import-progress-label { font-size: 13px; color: var(--text-secondary); font-weight: 500; text-align: center; min-height: 20px; }
.import-progress-track { width: 100%; background: #D4B896; border-radius: 99px; height: 10px; overflow: hidden; }
.import-progress-fill { height: 100%; background: linear-gradient(90deg, var(--primary), #E8C87A); border-radius: 99px; transition: width 0.35s ease; }
.import-progress-pct { font-size: 22px; font-weight: 800; color: var(--primary); letter-spacing: -1px; }

/* ── SANITY CHECK ──────────────────────────────────────────── */
.tf-sanity-check { color: var(--danger); font-weight: 600; }
.code-invalid { color: var(--danger) !important; background: #fff1f2; border-radius: 4px; padding: 2px 6px; }
.code-invalid-badge { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; background: var(--danger); color: #fff; border-radius: 50%; font-size: 10px; font-weight: 900; margin-left: 5px; vertical-align: middle; flex-shrink: 0; }

/* ── FLAT VIEW LOADER ──────────────────────────────────────── */
.flat-loader { display: flex; align-items: center; gap: 10px; padding: 20px 8px; color: var(--text-muted); font-size: 14px; }
.flat-loader-spinner { width: 20px; height: 20px; border: 2.5px solid #D4B896; border-top-color: var(--primary); border-radius: 50%; animation: spin .7s linear infinite; flex-shrink: 0; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── EXPORT TAB ────────────────────────────────────────────── */
.export-tab-wrap { display: flex; gap: 20px; flex-wrap: wrap; align-items: flex-start; padding-top: 4px; }
.export-col { flex: 1; min-width: 220px; display: flex; flex-direction: column; gap: 12px; }
.export-section { background: var(--card-bg); border: 1.5px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.export-section-title { font-size: 13px; font-weight: 700; color: var(--text); margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between; }
.export-format-grid { display: flex; flex-direction: column; gap: 8px; }
.export-format-opt { cursor: pointer; }
.export-format-opt input[type=radio] { display: none; }
.export-format-card { border: 2px solid var(--border); border-radius: 8px; padding: 10px 14px; transition: border-color .15s, background .15s; display: flex; align-items: center; gap: 12px; }
.export-format-opt input[type=radio]:checked + .export-format-card { border-color: var(--primary); background: #FFF8EC; }
.export-fmt-name { font-family: monospace; font-size: 14px; font-weight: 700; color: var(--primary); min-width: 72px; }
.export-fmt-desc { font-size: 12px; color: var(--text-muted); }
.export-lang-list { display: flex; flex-direction: column; gap: 2px; max-height: 360px; overflow-y: auto; }
.export-lang-item { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px; cursor: pointer; transition: background .1s; font-size: 13px; }
.export-lang-item:hover:not(.disabled) { background: #FAF6EE; }
.export-lang-item.disabled { opacity: .45; cursor: default; }
.export-lang-item input[type=checkbox] { accent-color: var(--primary); width: 15px; height: 15px; cursor: pointer; flex-shrink: 0; }
.export-lang-item code { font-size: 11px; color: var(--text-muted); background: #D4B896; padding: 1px 5px; border-radius: 3px; margin-left: auto; flex-shrink: 0; }

/* ── TRANSLATE TAB ─────────────────────────────────────────── */
.translate-tab-wrap { display: flex; gap: 20px; align-items: flex-start; padding-top: 4px; min-height: 400px; }
.translate-left { width: 320px; flex-shrink: 0; display: flex; flex-direction: column; gap: 20px; }
.translate-right { flex: 1; display: flex; flex-direction: column; background: var(--card-bg); border: 1.5px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.translate-section { background: var(--card-bg); border: 1.5px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.translate-section-title { font-size: 13px; font-weight: 700; color: var(--text); margin-bottom: 10px; }
.translate-section-hint { font-size: 11px; font-weight: 400; color: var(--text-muted); }
.src-lang-list { display: flex; flex-direction: column; gap: 6px; }
.src-lang-item { display: flex; align-items: center; gap: 8px; background: #FAF6EE; border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px; }
.src-lang-priority { width: 18px; height: 18px; background: var(--primary); color: #fff; border-radius: 50%; font-size: 10px; font-weight: 800; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.src-lang-flag { font-size: 18px; flex-shrink: 0; }
.src-lang-name { flex: 1; font-size: 13px; color: var(--text); }
.src-lang-name code { font-size: 11px; color: var(--text-muted); background: #D4B896; padding: 1px 4px; border-radius: 3px; }
.src-lang-actions { display: flex; gap: 3px; flex-shrink: 0; }
.src-lang-btn { background: none; border: 1.5px solid var(--border); border-radius: 5px; width: 26px; height: 26px; font-size: 13px; cursor: pointer; color: var(--text-secondary); display: flex; align-items: center; justify-content: center; padding: 0; transition: background .15s; }
.src-lang-btn:hover:not(:disabled) { background: #D4B896; }
.src-lang-btn:disabled { opacity: .3; cursor: default; }
.src-lang-btn-del:hover:not(:disabled) { background: #fee2e2; border-color: var(--danger); color: var(--danger); }
.translate-progress-wrap { background: var(--card-bg); border: 1.5px solid var(--border); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 8px; }
.translate-progress-pct { font-size: 20px; font-weight: 800; color: var(--primary); letter-spacing: -1px; text-align: center; }
.translate-progress-msg { font-size: 12px; color: var(--text-muted); text-align: center; min-height: 16px; word-break: break-all; }
.translate-log-header { padding: 8px 14px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--text-muted); border-bottom: 1.5px solid var(--border); background: #FAF6EE; flex-shrink: 0; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.tl-filter-label { display: flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 600; color: #d97706; cursor: pointer; text-transform: none; letter-spacing: 0; }
.tl-filter-label input[type=checkbox] { accent-color: #d97706; width: 13px; height: 13px; cursor: pointer; }
.translate-log { max-height: 420px; overflow-y: auto; padding: 10px 12px; display: flex; flex-direction: column; gap: 3px; font-family: monospace; font-size: 12px; }
.translate-log-empty { color: var(--text-muted); font-style: italic; font-family: inherit; }
.translate-log-entry { padding: 2px 0; white-space: pre-wrap; word-break: break-all; }
.tl-ok { color: #16a34a; }
.tl-skipped { color: var(--text-muted); }
.tl-warn { color: #d97706; }
.tl-error { color: var(--danger); }
.tl-info { color: var(--text-secondary); }
