:root {
  --bg-deep: #0a0a0f;
  --bg-surface: #12121a;
  --glass-bg: rgba(20, 20, 28, 0.72);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-border-hover: rgba(255, 255, 255, 0.14);
  --accent: #c8a97e;
  --accent-light: #e5c9a0;
  --accent-glow: rgba(200, 169, 126, 0.25);
  --text-primary: #f0ece4;
  --text-secondary: rgba(240, 236, 228, 0.65);
  --text-muted: rgba(240, 236, 228, 0.42);
  --success: #5dbf8f;
  --warning: #e5a94c;
  --danger: #e56b6b;
  --info: #6b9ce5;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --shadow-glass: 0 8px 32px rgba(0, 0, 0, 0.4);
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.35);
}

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

html, body {
  height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg-deep);
  overflow: hidden;
}

a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; color: inherit; font-family: inherit; }
input, textarea, select { font-family: inherit; font-size: inherit; color: inherit; }

.app-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: radial-gradient(ellipse at top left, #1a1520 0%, #0a0a0f 50%),
              radial-gradient(ellipse at bottom right, #15101a 0%, transparent 60%);
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.5;
}
.orb-1 { width: 400px; height: 400px; background: #c8a97e; top: -100px; left: -100px; opacity: 0.15; }
.orb-2 { width: 350px; height: 350px; background: #6b4e8a; bottom: -50px; right: 10%; opacity: 0.12; }
.orb-3 { width: 300px; height: 300px; background: #4a7a9e; top: 40%; right: -100px; opacity: 0.1; }

.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(24px) saturate(1.4);
  -webkit-backdrop-filter: blur(24px) saturate(1.4);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
}

.app-layout {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 260px 1fr;
  height: 100vh;
}

/* SIDEBAR */
.sidebar {
  margin: 16px 16px 16px 16px;
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow: hidden;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 8px 16px;
  border-bottom: 1px solid var(--glass-border);
}

.logo-mark {
  width: 44px; height: 44px;
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  color: #1a1a20;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 20px;
  box-shadow: 0 4px 16px var(--accent-glow);
}

.brand-text .brand-name { display: block; font-weight: 700; font-size: 16px; letter-spacing: 0.5px; }
.brand-text .brand-sub { display: block; font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.sidebar-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }

.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 13.5px; font-weight: 500;
  transition: all 0.2s ease;
  position: relative;
}
.nav-item:hover { background: rgba(255,255,255,0.04); color: var(--text-primary); }
.nav-item.active {
  background: rgba(200, 169, 126, 0.12);
  color: var(--accent-light);
}
.nav-item.active::before {
  content: '';
  position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 3px; height: 20px;
  background: linear-gradient(180deg, var(--accent), var(--accent-light));
  border-radius: 2px;
}

.sidebar-footer {
  border-top: 1px solid var(--glass-border);
  padding-top: 14px;
  display: flex; align-items: center; gap: 10px;
}
.user-info { display: flex; align-items: center; gap: 10px; flex: 1; }
.avatar {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  color: #1a1a20;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px;
}
.user-name { font-weight: 600; font-size: 13px; }
.user-role { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.btn-logout {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  transition: all 0.2s;
}
.btn-logout:hover { background: rgba(229, 107, 107, 0.12); color: var(--danger); }

/* MAIN */
.main-content {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 16px 16px 16px 0;
  gap: 12px;
}

.topbar {
  height: 56px;
  padding: 0 20px;
  display: flex; align-items: center; justify-content: space-between;
  border-radius: var(--radius-md);
}
.breadcrumb { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.page-badge {
  font-size: 12px;
  padding: 4px 12px;
  background: rgba(200, 169, 126, 0.15);
  color: var(--accent-light);
  border-radius: 100px;
}

.content-area {
  flex: 1;
  overflow-y: auto;
  padding-right: 4px;
}
.content-area::-webkit-scrollbar { width: 6px; }
.content-area::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }

/* DASHBOARD */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}
.page-title { font-size: 24px; font-weight: 700; letter-spacing: -0.3px; }
.page-subtitle { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.page-actions { display: flex; gap: 10px; }

.btn-primary, .btn-secondary, .btn-ghost {
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-weight: 500; font-size: 13px;
  transition: all 0.2s;
  display: inline-flex; align-items: center; gap: 8px;
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  color: #1a1a20;
  box-shadow: 0 4px 12px var(--accent-glow);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 20px var(--accent-glow); }
.btn-secondary {
  background: rgba(255,255,255,0.06);
  color: var(--text-primary);
  border: 1px solid var(--glass-border);
}
.btn-secondary:hover { background: rgba(255,255,255,0.1); }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--glass-bg);
  backdrop-filter: blur(20px) saturate(1.3);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 18px;
  transition: all 0.25s ease;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.stat-card:hover {
  border-color: var(--glass-border-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
}
.stat-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, var(--accent), transparent);
  opacity: 0.6;
}
.stat-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.8px; color: var(--text-muted); }
.stat-value { font-size: 26px; font-weight: 700; margin: 8px 0 4px; letter-spacing: -0.5px; }
.stat-trend { font-size: 11px; display: flex; align-items: center; gap: 4px; }
.stat-trend.up { color: var(--success); }
.stat-trend.down { color: var(--danger); }
.stat-trend.flat { color: var(--text-muted); }

.funnel-container { padding: 16px 0; }
.funnel-stages { display: flex; flex-direction: column; gap: 4px; }
.funnel-stage { display: flex; flex-direction: column; align-items: center; }
.funnel-bar {
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 14px;
  min-width: 20px;
  transition: width 0.6s ease;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.funnel-value { font-size: 13px; font-weight: 700; color: rgba(255,255,255,0.95); }
.funnel-label {
  display: flex;
  justify-content: space-between;
  width: 100%;
  max-width: 500px;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}
.funnel-pct { color: var(--accent); font-weight: 600; }
.funnel-arrow {
  font-size: 12px;
  color: var(--text-muted);
  margin: 2px 0;
  opacity: 0.5;
}
.funnel-summary {
  display: flex;
  gap: 24px;
  justify-content: center;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--glass-border);
}
.funnel-summary-item { text-align: center; }
.funnel-summary-value { font-size: 22px; font-weight: 700; color: var(--accent); }
.funnel-summary-label { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.charts-row {
  display: grid;
  grid-template-columns: 1.8fr 1fr;
  gap: 14px;
  margin-bottom: 20px;
}

.glass-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(20px) saturate(1.3);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 20px;
}
.panel-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.panel-title { font-size: 15px; font-weight: 600; }
.panel-tabs { display: flex; gap: 4px; background: rgba(0,0,0,0.25); border-radius: 8px; padding: 3px; }
.panel-tab { font-size: 12px; padding: 5px 12px; border-radius: 6px; color: var(--text-muted); font-weight: 500; }
.panel-tab.active { background: rgba(255,255,255,0.08); color: var(--text-primary); }

.chart-container { height: 240px; }

.chart-legend { display: flex; gap: 16px; margin-top: 10px; font-size: 11px; color: var(--text-muted); }
.chart-legend span { display: flex; align-items: center; gap: 5px; }
.chart-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

.top-pages-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.top-pages-table th { text-align: left; padding: 10px 12px; font-weight: 600; color: var(--text-muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 1px solid var(--glass-border); }
.top-pages-table td { padding: 10px 12px; border-bottom: 1px solid rgba(255,255,255,0.04); }
.top-pages-table tr:hover td { background: rgba(255,255,255,0.02); }
.page-name { color: var(--text-primary); font-weight: 500; }
.page-type-badge { font-size: 10px; padding: 2px 8px; border-radius: 100px; background: rgba(200,169,126,0.12); color: var(--accent-light); }

.quick-actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}
.quick-btn {
  background: var(--glass-bg);
  backdrop-filter: blur(20px) saturate(1.3);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex; flex-direction: column; align-items: flex-start; gap: 10px;
  transition: all 0.25s;
  text-align: left;
}
.quick-btn:hover { border-color: var(--accent); transform: translateY(-2px); }
.quick-btn .icon { font-size: 24px; }
.quick-btn .label { font-weight: 600; font-size: 14px; }
.quick-btn .desc { font-size: 12px; color: var(--text-muted); }

.system-status {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.status-item {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 16px;
}
.status-indicator { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; font-size: 13px; font-weight: 600; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; }
.status-dot.green { background: var(--success); box-shadow: 0 0 8px var(--success); }
.status-dot.yellow { background: var(--warning); box-shadow: 0 0 8px var(--warning); }
.status-dot.red { background: var(--danger); box-shadow: 0 0 8px var(--danger); }

.progress-bar { height: 6px; background: rgba(255,255,255,0.06); border-radius: 3px; overflow: hidden; margin-top: 8px; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-light)); border-radius: 3px; transition: width 0.3s; }

.log-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.log-item { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-muted); }
.log-item .log-user { color: var(--text-secondary); font-weight: 500; }

/* FORM */
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; color: var(--text-secondary); }
.form-control {
  width: 100%;
  padding: 11px 14px;
  background: #f5f5f7;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  color: #1a1a20;
  font-size: 13.5px;
  transition: all 0.2s;
}
.form-control:focus { outline: none; border-color: var(--accent); background: #ffffff; box-shadow: 0 0 0 3px rgba(200,169,126,0.2); }
.form-control::placeholder { color: #999; }

.form-error {
  background: rgba(229, 107, 107, 0.12);
  color: var(--danger);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 14px;
  display: none;
}
.form-error.show { display: block; }

/* AUTH */
.auth-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.auth-body .app-bg { z-index: 0; }
.auth-container { position: relative; z-index: 1; width: 380px; }
.auth-card { padding: 40px 32px; }
.auth-logo { display: flex; align-items: center; gap: 14px; margin-bottom: 32px; }
.auth-logo h1 { font-size: 20px; font-weight: 700; }
.auth-logo p { font-size: 12px; color: var(--text-muted); }
.auth-form .form-group { margin-bottom: 18px; }
.btn-auth { width: 100%; justify-content: center; padding: 12px; font-size: 14px; margin-top: 12px; }
.auth-footer { text-align: center; font-size: 11px; color: var(--text-muted); margin-top: 24px; }

/* DATA TABLE */
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th { text-align: left; padding: 12px 14px; font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: 0.6px; color: var(--text-muted); border-bottom: 1px solid var(--glass-border); background: rgba(0,0,0,0.15); }
.data-table td { padding: 12px 14px; border-bottom: 1px solid rgba(255,255,255,0.04); }
.data-table tr:hover td { background: rgba(255,255,255,0.02); }
.table-actions { display: flex; gap: 6px; }
.table-btn { padding: 5px 10px; border-radius: 6px; font-size: 12px; color: var(--text-secondary); background: rgba(255,255,255,0.04); }
.table-btn:hover { background: rgba(255,255,255,0.08); color: var(--text-primary); }
.table-btn.danger:hover { background: rgba(229,107,107,0.15); color: var(--danger); }
.status-pill { font-size: 11px; padding: 3px 10px; border-radius: 100px; font-weight: 500; }
.status-pill.published { background: rgba(93,191,143,0.15); color: var(--success); }
.status-pill.draft { background: rgba(229,169,76,0.15); color: var(--warning); }
.status-pill.untranslated { background: rgba(229,107,107,0.15); color: var(--danger); }
.status-pill.translated { background: rgba(93,191,143,0.15); color: var(--success); }
.status-pill.reviewed { background: rgba(200,169,126,0.15); color: var(--accent-light); }

/* FILTER BAR */
.filter-bar { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.filter-bar .form-control { width: auto; min-width: 200px; }
.filter-bar select { appearance: none; background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px; }

/* Content Management */
.badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 100px; font-size: 11px; font-weight: 600; letter-spacing: 0.3px; }
.badge-success { background: rgba(34,197,94,0.12); color: #22c55e; }
.badge-danger { background: rgba(239,68,68,0.12); color: #ef4444; }
.badge-warning { background: rgba(245,158,11,0.12); color: #f59e0b; }
.badge-neutral { background: rgba(148,163,184,0.12); color: #94a3b8; }
.btn-link { background: none; border: none; color: var(--accent); cursor: pointer; font-size: 13px; padding: 4px 8px; text-decoration: none; }
.btn-link:hover { text-decoration: underline; }
.btn-link.btn-danger { color: var(--danger, #ef4444); }
.btn-link.btn-success { color: #22c55e; }
.btn-sm { padding: 6px 14px; font-size: 12px; }
.pagination { display: flex; align-items: center; justify-content: space-between; padding: 12px 4px; margin-top: 8px; font-size: 13px; color: var(--text-muted); }
.pagination .btn-sm { background: rgba(255,255,255,0.06); border: 1px solid var(--glass-border); color: var(--text); border-radius: 8px; cursor: pointer; }
.pagination .btn-sm:hover { background: rgba(255,255,255,0.12); }
.data-table .empty { text-align: center; padding: 40px; color: var(--text-muted); }

/* I18N */
.lang-cards { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; margin-bottom: 24px; }
.lang-card { background: var(--glass-bg); border: 1px solid var(--glass-border); border-radius: var(--radius-md); padding: 16px; cursor: pointer; transition: all 0.2s; text-align: center; }
.lang-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.lang-flag { font-size: 28px; margin-bottom: 6px; }
.lang-code { font-weight: 700; font-size: 14px; }
.lang-progress { margin-top: 8px; }
.lang-progress .progress-bar { height: 4px; }
.lang-stats { font-size: 11px; color: var(--text-muted); margin-top: 6px; }

.editor-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--glass-border); border-radius: var(--radius-md); overflow: hidden; }
.editor-pane { background: rgba(0,0,0,0.25); padding: 16px; }
.editor-pane.source { background: rgba(0,0,0,0.15); }
.editor-pane h4 { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); margin-bottom: 12px; }
.entry-row { display: grid; grid-template-columns: 110px 1fr; gap: 10px; padding: 10px 0; border-bottom: 1px solid rgba(255,255,255,0.04); align-items: start; }
.entry-key { font-size: 11px; font-family: 'SF Mono', monospace; color: var(--text-muted); word-break: break-all; padding-top: 4px; }
.entry-value { font-size: 13px; line-height: 1.5; }
.entry-value textarea { width: 100%; padding: 8px 10px; background: rgba(255,255,255,0.04); border: 1px solid var(--glass-border); border-radius: 6px; color: var(--text-primary); font-size: 13px; min-height: 36px; resize: vertical; }
.entry-value textarea:focus { outline: none; border-color: var(--accent); }

/* CODE EDITOR */
.code-editor {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 13px;
  line-height: 1.6;
  width: 100%;
  min-height: 500px;
  padding: 16px;
  background: rgba(0,0,0,0.4);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  tab-size: 2;
}

/* UTILITY */
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.text-muted { color: var(--text-muted); }
.text-accent { color: var(--accent); }
.text-sm { font-size: 12px; }
.text-lg { font-size: 16px; }

/* TOAST */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 1000; display: flex; flex-direction: column; gap: 8px; }
.toast { padding: 12px 18px; border-radius: var(--radius-sm); background: var(--glass-bg); backdrop-filter: blur(20px); border: 1px solid var(--glass-border); font-size: 13px; animation: slideIn 0.3s ease; }
.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.info { border-left: 3px solid var(--info); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* MODAL */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.6); backdrop-filter: blur(8px); z-index: 100; display: flex; align-items: center; justify-content: center; }
.modal { background: var(--glass-bg); backdrop-filter: blur(24px); border: 1px solid var(--glass-border); border-radius: var(--radius-lg); padding: 28px; max-width: 500px; width: 90%; }
.modal h3 { font-size: 18px; font-weight: 700; margin-bottom: 10px; }
.modal p { color: var(--text-secondary); margin-bottom: 20px; font-size: 14px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }
.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.5);
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  padding: 0;
}
.modal-close:hover {
  background: rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.8);
}

/* RESPONSIVE */
@media (max-width: 1200px) {
  .stats-grid { grid-template-columns: repeat(4, 1fr); }
  .charts-row { grid-template-columns: 1fr; }
  .lang-cards { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 900px) {
  .app-layout { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .main-content { padding: 12px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .funnel-summary { flex-wrap: wrap; gap: 16px; }
  .quick-actions { grid-template-columns: repeat(2, 1fr); }
  .system-status { grid-template-columns: 1fr; }
}
