/* ============================================================
   MBC INSIDE — Admin Panel
   Dark + Light theme · Responsive
   ============================================================ */

:root, [data-theme="light"] {
  /* Light theme (default) */
  --bg-0:        #f4f6fa;
  --bg-1:        #ffffff;
  --bg-2:        #fafbfd;
  --bg-elev:     #ffffff;
  --bg-hover:    #f6f9fc;

  --line:        #e6ebf2;
  --line-strong: #d4dce7;

  --text:        #0f172a;
  --dim:         #475569;
  --mute:        #94a3b8;

  --blue:        #4263eb;
  --blue-hi:     #5a7bff;
  --blue-lo:     #2d4dd1;
  --blue-soft:   #eef2ff;
  --blue-on:     #ffffff;

  --green:       #16a34a;
  --green-soft:  #ecfdf5;
  --amber:       #f59e0b;
  --amber-soft:  #fef3c7;
  --red:         #ef4444;
  --red-soft:    #fee2e2;
  --purple:      #8b5cf6;
  --purple-soft: #f3e8ff;
  --pink:        #ec4899;
  --pink-soft:   #fce7f3;
  --teal:        #14b8a6;
  --teal-soft:   #ccfbf1;

  --shadow-sm:   0 1px 2px rgba(15,23,42,0.04), 0 1px 3px rgba(15,23,42,0.04);
  --shadow-md:   0 4px 12px rgba(15,23,42,0.06), 0 1px 4px rgba(15,23,42,0.04);
  --shadow-lg:   0 20px 50px -20px rgba(15,23,42,0.18);

  --ease:        cubic-bezier(.2,.7,.2,1);
  color-scheme: light;
}

[data-theme="dark"] {
  --bg-0:        #07090f;
  --bg-1:        #0e1320;
  --bg-2:        #131a2a;
  --bg-elev:     #161c2e;
  --bg-hover:    #1a2236;

  --line:        rgba(255,255,255,0.06);
  --line-strong: rgba(255,255,255,0.12);

  --text:        #e8eef8;
  --dim:         #a8b2c4;
  --mute:        #6c7689;

  --blue:        #5a7bff;
  --blue-hi:     #7d97ff;
  --blue-lo:     #3b5fea;
  --blue-soft:   rgba(90,123,255,0.12);
  --blue-on:     #02101f;

  --green-soft:  rgba(22,163,74,0.15);
  --amber-soft:  rgba(245,158,11,0.15);
  --red-soft:    rgba(239,68,68,0.15);
  --purple-soft: rgba(139,92,246,0.15);
  --pink-soft:   rgba(236,72,153,0.15);
  --teal-soft:   rgba(20,184,166,0.15);

  --shadow-sm:   0 1px 2px rgba(0,0,0,0.4);
  --shadow-md:   0 8px 24px rgba(0,0,0,0.4);
  --shadow-lg:   0 30px 60px -20px rgba(0,0,0,0.6);

  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg-0);
  color: var(--text);
  font-family: 'Inter', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  line-height: 1.55;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; }

h1 { font-family: 'Space Grotesk', sans-serif; font-weight: 600; letter-spacing: -0.02em; font-size: 28px; margin: 0 0 6px; }
h2 { font-family: 'Space Grotesk', sans-serif; font-weight: 600; letter-spacing: -0.015em; font-size: 18px; margin: 0 0 12px; }
p  { color: var(--dim); margin: 0 0 12px; }

code {
  background: var(--blue-soft);
  border: 1px solid color-mix(in srgb, var(--blue) 25%, transparent);
  padding: 1px 8px;
  border-radius: 6px;
  font-size: 12.5px;
  color: var(--blue);
  font-family: 'Space Grotesk', monospace;
}

.muted, .muted-link { color: var(--mute) !important; }
.muted-link { text-decoration: underline; text-underline-offset: 3px; transition: color .2s var(--ease); display: inline-block; margin-top: 14px; font-size: 13px; }
.muted-link:hover { color: var(--blue) !important; }
.muted-link.sm { font-size: 12px; margin-top: 4px; }

/* ============ LOGIN ============ */
.login-shell {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 40px 20px;
  background:
    radial-gradient(60% 60% at 20% 10%, var(--blue-soft) 0%, transparent 60%),
    radial-gradient(50% 50% at 90% 90%, color-mix(in srgb, var(--blue) 18%, transparent) 0%, transparent 60%),
    var(--bg-0);
}
.login-card {
  width: 100%;
  max-width: 440px;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 36px;
  box-shadow: var(--shadow-lg);
}
.brand-mini {
  display: inline-flex; align-items: center; gap: 10px;
  margin-bottom: 24px;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600; font-size: 14px;
  color: var(--text);
}
.brand-mini img { height: 28px; }

/* ============ APP SHELL ============ */
.shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--bg-1);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 22px 18px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.side-nav {
  margin-top: 22px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}
.side-section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--mute);
  margin: 16px 14px 8px;
}
.side-nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  color: var(--dim);
  transition: all .15s var(--ease);
}
.side-nav a svg { width: 18px; height: 18px; flex-shrink: 0; }
.side-nav a:hover { background: var(--bg-hover); color: var(--text); }
.side-nav a.active {
  background: var(--blue);
  color: var(--blue-on);
}
.side-nav a.active svg { color: var(--blue-on); }
.side-nav a .count {
  margin-left: auto;
  background: var(--bg-hover);
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  color: var(--mute);
  font-variant-numeric: tabular-nums;
  min-width: 22px;
  text-align: center;
}
.side-nav a.active .count { background: rgba(255,255,255,0.25); color: var(--blue-on); }
.side-nav a .count.badge-new { background: var(--amber); color: #fff; }
.side-nav a.active .count.badge-new { background: rgba(255,255,255,0.95); color: var(--blue); }

.side-foot {
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.theme-toggle-admin {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--bg-hover);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: all .15s var(--ease);
  justify-content: center;
}
.theme-toggle-admin:hover { background: var(--blue-soft); border-color: var(--blue); color: var(--blue); }
.theme-toggle-admin svg { width: 16px; height: 16px; flex-shrink: 0; }
.theme-toggle-admin .toggle-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
[data-theme="dark"]  .theme-toggle-admin .ico-moon { display: none; }
[data-theme="light"] .theme-toggle-admin .ico-sun  { display: none; }

.user-card { display: flex; align-items: center; gap: 10px; padding: 6px 4px; }
.user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue), var(--blue-lo));
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-weight: 600;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 13px;
  flex-shrink: 0;
}
.user-meta { min-width: 0; }
.user-name {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.content {
  padding: 32px 40px 64px;
  max-width: 1280px;
  width: 100%;
}

.page-head { margin-bottom: 24px; }
.page-head.row { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.page-head h1 { margin-bottom: 4px; font-size: 24px; }
.page-head p { max-width: 640px; font-size: 14px; }
.back-link {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--blue);
  font-weight: 600;
  display: inline-block;
  margin-bottom: 6px;
}

/* ============ KPI CARDS ============ */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.kpi-card {
  display: block;
  padding: 22px;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: 14px;
  transition: all .2s var(--ease);
  box-shadow: var(--shadow-sm);
}
.kpi-card:hover {
  transform: translateY(-2px);
  border-color: var(--blue);
  box-shadow: var(--shadow-md);
}
.kpi-ico {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: var(--blue-soft);
  color: var(--blue);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 14px;
}
.kpi-ico svg { width: 20px; height: 20px; }
.kpi-num {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 32px; font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text);
  line-height: 1;
}
.kpi-label { color: var(--dim); font-size: 13px; margin-top: 4px; }
.kpi-cta {
  margin-top: 12px;
  font-size: 12px; letter-spacing: 0.06em;
  color: var(--blue);
  font-weight: 600;
}

.info-card {
  padding: 22px;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
}
.info-card p { font-size: 14px; }
.info-card strong { color: var(--text); font-weight: 600; }

/* ============ BUTTONS ============ */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px;
  border-radius: 10px;
  font-weight: 600; font-size: 13.5px;
  cursor: pointer;
  font-family: inherit;
  border: 1px solid transparent;
  transition: all .15s var(--ease);
  text-decoration: none;
  white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; }
.btn-primary {
  background: var(--blue);
  color: var(--blue-on);
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover { background: var(--blue-lo); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.btn-ghost {
  background: var(--bg-1);
  color: var(--text);
  border-color: var(--line-strong);
}
.btn-ghost:hover { background: var(--bg-hover); border-color: var(--blue); color: var(--blue); }

.btn-sm {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px; font-weight: 600;
  background: var(--bg-1);
  border: 1px solid var(--line-strong);
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  transition: all .15s var(--ease);
}
.btn-sm:hover { background: var(--blue-soft); border-color: var(--blue); color: var(--blue); }
.btn-sm.danger:hover { background: var(--red-soft); border-color: var(--red); color: var(--red); }
.btn-sm.starred { color: var(--amber); background: var(--amber-soft); border-color: var(--amber); }

/* ============ FORMS ============ */
.form-card {
  padding: 28px;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 22px;
}
.field { display: flex; flex-direction: column; gap: 6px; }
.field.span-2 { grid-column: 1 / -1; }
.field.check { gap: 10px; padding-top: 4px; }

label {
  font-size: 11px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--mute);
  font-weight: 700;
}
input[type=text], input[type=email], input[type=url], input[type=password],
input[type=number], textarea, select {
  background: var(--bg-1);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 10px 13px;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  transition: all .15s var(--ease);
  width: 100%;
}
[data-theme="dark"] input, [data-theme="dark"] textarea, [data-theme="dark"] select {
  background: var(--bg-0);
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-soft);
}
textarea { resize: vertical; min-height: 100px; line-height: 1.55; }

.checkbox-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 13px;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  font-size: 14px;
  text-transform: none; letter-spacing: 0; font-weight: 500;
  cursor: pointer;
  transition: all .15s var(--ease);
}
[data-theme="dark"] .checkbox-row { background: var(--bg-0); }
.checkbox-row:hover { background: var(--blue-soft); border-color: var(--blue); }
.checkbox-row input { accent-color: var(--blue); }

.form-actions {
  display: flex; justify-content: flex-end; gap: 10px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

/* ============ ALERTS ============ */
.alert {
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 14px;
  margin-bottom: 20px;
  display: flex; align-items: center; gap: 12px;
}
.alert.success { background: var(--green-soft); color: var(--green); border: 1px solid color-mix(in srgb, var(--green) 25%, transparent); }
.alert.error   { background: var(--red-soft); color: var(--red); border: 1px solid color-mix(in srgb, var(--red) 25%, transparent); }
.alert.info    { background: var(--blue-soft); color: var(--blue); border: 1px solid color-mix(in srgb, var(--blue) 25%, transparent); }

/* ============ TABLES (projects, reviews) ============ */
.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.data-table th {
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--mute);
  padding: 14px 18px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
}
.data-table td {
  padding: 14px 18px;
  font-size: 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--bg-hover); }

.row-title { color: var(--text); font-weight: 600; margin-bottom: 2px; }
.row-sub { color: var(--mute); font-size: 12px; }
.quote-cell { color: var(--dim); font-style: italic; max-width: 380px; }
.actions { white-space: nowrap; }

.status {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.status.published { background: var(--green-soft); color: var(--green); border: 1px solid color-mix(in srgb, var(--green) 25%, transparent); }
.status.draft     { background: var(--bg-hover); color: var(--mute); border: 1px solid var(--line-strong); }
.status.featured  { background: var(--blue-soft); color: var(--blue); border: 1px solid color-mix(in srgb, var(--blue) 25%, transparent); }

.empty {
  text-align: center;
  padding: 60px 40px;
  border: 1px dashed var(--line-strong);
  border-radius: 14px;
  color: var(--dim);
  background: var(--bg-1);
}
.empty p { margin-bottom: 18px; }

/* ============================================================
   INBOX — Gmail-style table
   ============================================================ */
.inbox-shell {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 24px;
  align-items: start;
}
@media (max-width: 900px) {
  .inbox-shell { grid-template-columns: 1fr; }
}

.inbox-sidebar {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 10px;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 24px;
}
.inbox-sidebar h4 {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--mute);
  margin: 8px 12px 8px;
}
.inbox-sidebar .filter-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  border-radius: 9px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--dim);
  transition: all .15s var(--ease);
}
.inbox-sidebar .filter-link svg { width: 16px; height: 16px; flex-shrink: 0; }
.inbox-sidebar .filter-link:hover { background: var(--bg-hover); color: var(--text); }
.inbox-sidebar .filter-link.active {
  background: var(--blue);
  color: var(--blue-on);
}
.inbox-sidebar .filter-link.active svg { color: var(--blue-on); }
.inbox-sidebar .filter-link .count {
  margin-left: auto;
  font-size: 11px;
  font-weight: 600;
  color: var(--mute);
  font-variant-numeric: tabular-nums;
}
.inbox-sidebar .filter-link.active .count { color: rgba(255,255,255,0.9); }

.inbox-main {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.inbox-topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.inbox-search-wrap {
  flex: 1;
  position: relative;
}
.inbox-search-wrap input {
  width: 100%;
  background: var(--bg-2);
  border: 1px solid transparent;
  padding: 10px 14px 10px 40px;
  border-radius: 999px;
  font: inherit;
  font-size: 13.5px;
  color: var(--text);
  transition: all .15s var(--ease);
}
.inbox-search-wrap input:focus {
  background: var(--bg-1);
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-soft);
  outline: none;
}
.inbox-search-wrap::before {
  content: '';
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px; height: 16px;
  background: no-repeat center / contain;
  background-image: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
}

.inbox-table {
  width: 100%;
  border-collapse: collapse;
}
.inbox-table thead th {
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  color: var(--text);
  padding: 12px 16px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
}
.inbox-table th.col-check { width: 50px; padding: 12px 0 12px 20px; }
.inbox-table th.col-from { width: 230px; }
.inbox-table th.col-time { width: 100px; }
.inbox-table th.col-actions { width: 130px; }

.inbox-table tbody tr {
  border-bottom: 1px solid var(--line);
  transition: all .12s var(--ease);
  cursor: pointer;
}
.inbox-table tbody tr:last-child { border-bottom: none; }
.inbox-table tbody tr:hover { background: var(--bg-hover); box-shadow: inset 3px 0 0 var(--blue); }
.inbox-table tbody tr.unread { background: color-mix(in srgb, var(--blue-soft) 60%, var(--bg-1)); }
.inbox-table tbody tr.unread .from-name,
.inbox-table tbody tr.unread .msg-subject { font-weight: 700; color: var(--text); }
.inbox-table tbody tr.unread .from-name::before {
  content: '';
  position: absolute;
  left: -14px;
  top: 50%;
  transform: translateY(-50%);
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--blue);
}

.inbox-table td {
  padding: 14px 16px;
  font-size: 14px;
  color: var(--text);
  vertical-align: middle;
}
.inbox-table td.col-check { padding: 14px 0 14px 20px; }

.checkbox-cell {
  width: 18px; height: 18px;
  border: 2px solid var(--line-strong);
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.from-cell {
  display: flex; align-items: center; gap: 12px;
  position: relative;
}
.from-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 13px;
  flex-shrink: 0;
  position: relative;
  background-size: cover;
  background-position: center;
}
.from-avatar.color-1 { background: #ef4444; }
.from-avatar.color-2 { background: #f59e0b; }
.from-avatar.color-3 { background: #10b981; }
.from-avatar.color-4 { background: #3b82f6; }
.from-avatar.color-5 { background: #8b5cf6; }
.from-avatar.color-6 { background: #ec4899; }
.from-avatar.color-7 { background: #14b8a6; }
.from-avatar.color-8 { background: #6366f1; }
.from-avatar .new-dot {
  position: absolute;
  top: -2px; right: -2px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--blue);
  border: 2px solid var(--bg-1);
}
.from-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  position: relative;
}

.msg-cell {
  min-width: 0;
}
.msg-subject {
  font-weight: 600;
  color: var(--text);
  margin-right: 8px;
}
.msg-snippet {
  color: var(--mute);
}
.msg-cell-inner {
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.col-time {
  color: var(--mute);
  font-size: 12.5px;
  white-space: nowrap;
}

.tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: var(--blue-soft);
  color: var(--blue);
}
.tag.tag-Security { background: var(--red-soft); color: var(--red); }
.tag.tag-Update   { background: var(--amber-soft); color: var(--amber); }
.tag.tag-HR       { background: var(--purple-soft); color: var(--purple); }
.tag.tag-Support  { background: var(--green-soft); color: var(--green); }
.tag.tag-Finance  { background: var(--blue-soft); color: var(--blue); }
.tag.tag-Client   { background: var(--teal-soft); color: var(--teal); }
.tag.tag-Design   { background: var(--pink-soft); color: var(--pink); }
.tag.tag-Dev      { background: var(--purple-soft); color: var(--purple); }

.row-icons {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.row-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px; height: 30px;
  border-radius: 8px;
  background: transparent;
  border: none;
  color: var(--mute);
  cursor: pointer;
  transition: all .12s var(--ease);
  padding: 0;
}
.row-icon:hover { background: var(--bg-hover); color: var(--text); }
.row-icon svg { width: 16px; height: 16px; }
.row-icon.is-star.active { color: var(--amber); }
.row-icon.is-star.active svg { fill: var(--amber); stroke: var(--amber); }
.row-icon.is-bookmark.active { color: var(--blue); }
.row-icon.is-bookmark.active svg { fill: var(--blue); stroke: var(--blue); }

.inbox-empty {
  text-align: center;
  padding: 80px 40px;
  color: var(--mute);
  font-size: 14px;
}

/* ============ Single Message View ============ */
.msg-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 20px;
  align-items: start;
}
@media (max-width: 1100px) { .msg-grid { grid-template-columns: 1fr; } }

.msg-thread { display: flex; flex-direction: column; gap: 14px; }
.msg-bubble {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px;
  box-shadow: var(--shadow-sm);
}
.msg-bubble.sent {
  background: var(--blue-soft);
  border-color: color-mix(in srgb, var(--blue) 25%, transparent);
}
.msg-bubble.failed { background: var(--red-soft); border-color: color-mix(in srgb, var(--red) 25%, transparent); }
.msg-header {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.msg-avatar {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--mute), #475569);
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-weight: 600;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 13px;
  flex-shrink: 0;
}
.msg-avatar.own { background: linear-gradient(135deg, var(--blue), var(--blue-lo)); }
.msg-meta { flex: 1; min-width: 0; }
.msg-from {
  font-weight: 600; font-size: 15px;
  color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.msg-email {
  color: var(--mute); font-weight: 400;
  font-family: 'Space Grotesk', monospace; font-size: 13px;
}
.msg-sub { font-size: 13px; color: var(--mute); margin-top: 2px; }
.msg-body {
  font-size: 15px; line-height: 1.65;
  color: var(--text);
  white-space: pre-wrap; word-break: break-word;
}
.msg-footer {
  display: flex; gap: 16px; flex-wrap: wrap;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.msg-info { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--mute); }
.msg-error {
  margin-top: 12px;
  padding: 10px 14px;
  background: var(--red-soft);
  border: 1px solid color-mix(in srgb, var(--red) 25%, transparent);
  border-radius: 8px;
  font-size: 13px;
  color: var(--red);
}

.msg-actions-top { display: flex; gap: 6px; flex-wrap: wrap; }
.msg-reply {
  position: sticky;
  top: 24px;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px;
  box-shadow: var(--shadow-sm);
}
.msg-reply h3 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 17px;
  margin: 0 0 16px;
  font-weight: 600;
}
.msg-reply .field { margin-bottom: 12px; }
.msg-reply .field input[disabled] { opacity: 0.6; cursor: not-allowed; background: var(--bg-2); }

.signature-preview {
  margin: 12px 0 18px;
  padding: 12px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 12px;
}
.signature-preview .sig-label {
  color: var(--mute);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
  margin-bottom: 8px;
  font-size: 10px;
}
.signature-preview .sig-body {
  background: #fff;
  color: #222;
  padding: 12px;
  border-radius: 6px;
  max-height: 120px;
  overflow: auto;
}

/* ============ SETTINGS ============ */
.settings-tabs {
  display: flex; gap: 4px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--line);
}
.settings-tabs a {
  padding: 10px 16px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--mute);
  border-bottom: 2px solid transparent;
  transition: all .15s var(--ease);
  margin-bottom: -1px;
}
.settings-tabs a:hover { color: var(--text); }
.settings-tabs a.active {
  color: var(--blue);
  border-bottom-color: var(--blue);
  font-weight: 600;
}

.sig-preview-canvas {
  background: var(--bg-2);
  padding: 24px;
  border-radius: 12px;
  border: 1px solid var(--line);
}
.sig-sample {
  background: #ffffff;
  padding: 24px;
  border-radius: 8px;
  color: #222;
  font-family: Inter, system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  max-width: 600px;
  margin: 0 auto;
}

/* ============================================================
   TEXTS EDITOR — split layout with live preview iframe
   ============================================================ */
/* Pagina cu editor de texte: lasa-o sa foloseasca tot ecranul, nu doar 1280px */
.content:has(.texts-grid) {
  max-width: none;
  padding: 24px 32px 48px;
}

.texts-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: 24px;
  align-items: start;
}
@media (max-width: 1200px) { .texts-grid { grid-template-columns: 1fr; } }

.texts-form { max-height: calc(100vh - 200px); overflow-y: auto; }
.texts-form .form-grid { gap: 12px; margin-bottom: 0; }

.text-group {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-bottom: 12px;
}
.text-group:not([open]) { overflow: hidden; }
.text-group summary { border-radius: 12px 12px 0 0; }
.text-group:not([open]) summary { border-radius: 12px; }
.text-group summary {
  padding: 14px 18px;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
  list-style: none;
  position: relative;
  user-select: none;
  transition: background .15s var(--ease);
}
.text-group summary:hover { background: var(--bg-hover); }
.text-group summary::after {
  content: "+";
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 20px;
  color: var(--blue);
  font-weight: 400;
}
.text-group[open] summary::after { content: "−"; }
.text-group[open] summary {
  border-bottom: 1px solid var(--line);
  background: var(--bg-2);
}
.text-group > div.form-grid,
.text-group > p { padding: 18px; }
.text-group p { font-size: 12px; color: var(--mute); margin: 0 18px 18px; }

.texts-preview {
  position: sticky;
  top: 24px;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}
.preview-bar {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
}
.preview-bar-left { display: flex; gap: 6px; }
.preview-bar-left .dot { width: 10px; height: 10px; border-radius: 50%; }
.preview-bar-left .dot:nth-child(1) { background: #ff5f57; }
.preview-bar-left .dot:nth-child(2) { background: #febc2e; }
.preview-bar-left .dot:nth-child(3) { background: #28c840; }
.preview-bar-url {
  flex: 1;
  font-family: 'Space Grotesk', monospace;
  font-size: 12px;
  color: var(--mute);
  background: var(--bg-1);
  padding: 5px 14px;
  border-radius: 999px;
  text-align: center;
  border: 1px solid var(--line);
}
.preview-refresh {
  background: var(--blue-soft);
  border: 1px solid color-mix(in srgb, var(--blue) 30%, transparent);
  color: var(--blue);
  width: 30px; height: 30px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; padding: 0;
}
.preview-refresh:hover { background: var(--blue); color: #fff; }
.preview-refresh svg { width: 14px; height: 14px; }
.texts-preview iframe {
  width: 100%;
  height: calc(100vh - 260px);
  min-height: 600px;
  border: none;
  background: var(--bg-0);
  display: block;
}

/* ============================================================
   RESPONSIVE BREAKPOINTS
   ============================================================ */
@media (max-width: 1024px) {
  .shell { grid-template-columns: 220px 1fr; }
  .content { padding: 28px 28px 60px; }
}

@media (max-width: 840px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: sticky;
    top: 0;
    height: auto;
    flex-direction: row;
    padding: 12px 16px;
    gap: 12px;
    border-right: none;
    border-bottom: 1px solid var(--line);
    overflow-x: auto;
    z-index: 10;
  }
  .brand-mini { margin: 0; flex-shrink: 0; }
  .side-nav { flex-direction: row; gap: 4px; margin-top: 0; flex: 0 1 auto; }
  .side-nav a { padding: 8px 10px; font-size: 13px; }
  .side-nav a .count { padding: 1px 6px; font-size: 10px; }
  .side-section-label { display: none; }
  .side-foot { flex-direction: row; border-top: none; padding-top: 0; margin-left: auto; }
  .user-card .user-meta { display: none; }
  .theme-toggle-admin { padding: 8px; }
  .theme-toggle-admin .toggle-label { display: none; }

  .content { padding: 22px 18px 60px; }
  .page-head h1 { font-size: 22px; }

  .form-grid { grid-template-columns: 1fr; }

  /* Inbox: collapse table on mobile */
  .inbox-shell { grid-template-columns: 1fr; }
  .inbox-sidebar {
    position: static;
    padding: 8px;
  }
  .inbox-sidebar h4 { display: none; }
  .inbox-sidebar > div { display: flex; gap: 4px; overflow-x: auto; }
  .inbox-sidebar .filter-link { padding: 8px 12px; font-size: 12.5px; white-space: nowrap; }

  .inbox-topbar { padding: 12px 14px; }
  .inbox-table thead { display: none; }
  .inbox-table tbody tr {
    display: grid;
    grid-template-columns: auto 1fr auto;
    grid-template-areas:
      "avatar from time"
      "avatar msg msg"
      "avatar actions actions";
    gap: 6px 12px;
    padding: 14px 16px;
  }
  .inbox-table td { padding: 0; border: none; }
  .inbox-table td.col-check { display: none; }
  .inbox-table td.col-from { grid-area: from; }
  .inbox-table td.col-from .from-cell { gap: 0; }
  .inbox-table td.col-from .from-avatar { grid-area: avatar; position: absolute; left: 16px; }
  .inbox-table td.col-msg { grid-area: msg; min-width: 0; }
  .inbox-table td.col-tag { display: none; }
  .inbox-table td.col-time { grid-area: time; text-align: right; }
  .inbox-table td.col-actions { grid-area: actions; }
  .inbox-table tbody tr { position: relative; padding-left: 64px; }
}

@media (max-width: 480px) {
  .content { padding: 16px 14px 50px; }
  .form-card { padding: 18px; }
  .msg-reply { padding: 16px; }
  .data-table { font-size: 13px; }
  .data-table th, .data-table td { padding: 10px 12px; }
  .row-icons { gap: 2px; }
  .row-icon { width: 26px; height: 26px; }
}

/* ============================================================
   QUILL editor — adaptare pe tema admin
   ============================================================ */
.quill-host {
  margin-top: 4px;
  margin-bottom: 4px;
  display: block;
  flex: 0 0 auto;
  min-width: 0;
}
.ql-toolbar.ql-snow {
  border: 1px solid var(--line);
  border-top-left-radius: 10px;
  border-top-right-radius: 10px;
  background: var(--bg-2);
  padding: 6px 8px;
}
.ql-toolbar.ql-snow .ql-formats { margin-right: 10px; }
.ql-container.ql-snow {
  border: 1px solid var(--line);
  border-top: 0;
  border-bottom-left-radius: 10px;
  border-bottom-right-radius: 10px;
  background: var(--bg-1);
  font-family: inherit;
  font-size: 14px;
  min-height: 70px;
  height: auto;
  overflow: visible;
}
/* Editori mai scunzi pe textarea-uri cu rows mici */
textarea.quill-rich[rows="2"] + .quill-host .ql-container.ql-snow,
textarea.quill-rich[rows="3"] + .quill-host .ql-container.ql-snow {
  min-height: 60px;
}
textarea.quill-rich[rows="4"] + .quill-host .ql-container.ql-snow {
  min-height: 100px;
}
/* Editorul intern: crește natural cu conținutul (fără scroll intern care lasă rândul grid mic) */
.quill-host .ql-editor {
  overflow-y: visible;
  max-height: none;
  height: auto;
}
.ql-editor {
  color: var(--text);
  padding: 10px 14px;
  line-height: 1.5;
}
.ql-editor.ql-blank::before { color: var(--mute); font-style: normal; left: 14px; right: 14px; }
/* Spatiere clara intre campuri din accordion-uri (Quill + inputs) */
.text-group .form-grid { gap: 22px 16px; margin-bottom: 0; }
.text-group .form-grid .field { margin-bottom: 0; }
/* Campurile care contin un Quill primesc mai mult spatiu jos */
.text-group .form-grid .field:has(.quill-host) {
  padding-bottom: 8px;
}
/* Quill host: izoleaza de continutul de dupa */
.quill-host { isolation: isolate; position: relative; z-index: 0; }
/* Asigura ca textarea ascuns nu ocupa loc */
textarea.quill-rich { height: 0 !important; min-height: 0 !important; padding: 0 !important; margin: 0 !important; border: 0 !important; opacity: 0; position: absolute; left: -9999px; }
.ql-snow .ql-stroke { stroke: var(--text); }
.ql-snow .ql-fill, .ql-snow .ql-stroke.ql-fill { fill: var(--text); }
.ql-snow .ql-picker { color: var(--text); }
.ql-snow .ql-picker-options { background: var(--bg-1); border-color: var(--line); }
.ql-snow.ql-toolbar button:hover .ql-stroke,
.ql-snow.ql-toolbar button.ql-active .ql-stroke { stroke: var(--blue); }
.ql-snow.ql-toolbar button:hover .ql-fill,
.ql-snow.ql-toolbar button.ql-active .ql-fill { fill: var(--blue); }

/* ============================================================
   IMAGE UPLOAD WIDGET
   ============================================================ */
.img-upload { display: block; }
.img-upload-ui {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 10px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: var(--bg-2);
}
.img-upload-thumb {
  width: 84px; height: 84px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg-1);
  border: 1px solid var(--line);
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.img-upload-thumb img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
.img-upload-thumb.broken { font-size: 11px; color: var(--mute); padding: 8px; text-align: center; }
.img-upload-empty {
  width: 84px; height: 84px;
  border-radius: 10px;
  border: 1px dashed var(--line);
  background: var(--bg-1);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; color: var(--mute); text-align: center;
  flex-shrink: 0;
}
.img-upload-actions { flex: 1; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.img-upload-url { flex: 1; min-width: 200px; padding: 8px 10px; font-size: 12px; }
.btn-sm { padding: 6px 12px !important; font-size: 12px !important; }

/* ============================================================
   IMAGE GALLERY (multi-upload, reorder via drag&drop)
   ============================================================ */
.img-gallery-upload { display: block; }
.gallery-ui {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
  padding: 10px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: var(--bg-2);
}
.gallery-thumb {
  position: relative;
  aspect-ratio: 4/3;
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-1);
  border: 1px solid var(--line);
  cursor: grab;
  transition: transform .15s var(--ease), box-shadow .15s var(--ease);
}
.gallery-thumb:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.gallery-thumb.dragging { opacity: .4; cursor: grabbing; }
.gallery-thumb.over { outline: 2px dashed var(--blue); outline-offset: -4px; }
.gallery-thumb.broken { background: var(--red-soft); }
.gallery-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gallery-ord {
  position: absolute; top: 6px; left: 6px;
  background: rgba(0,0,0,0.65); color: #fff;
  font-size: 11px; font-weight: 700;
  padding: 2px 7px; border-radius: 999px;
  pointer-events: none;
}
.gallery-del {
  position: absolute; top: 6px; right: 6px;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: rgba(0,0,0,0.65); color: #fff;
  border: 0; cursor: pointer;
  font-size: 18px; line-height: 1; padding: 0;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s var(--ease);
}
.gallery-del:hover { background: var(--red); }
.gallery-add {
  aspect-ratio: 4/3;
  border-radius: 8px;
  border: 2px dashed var(--line);
  background: var(--bg-1);
  color: var(--mute);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; cursor: pointer;
  transition: border-color .15s var(--ease), color .15s var(--ease), background .15s var(--ease);
}
.gallery-add:hover { border-color: var(--blue); color: var(--blue); background: var(--blue-soft); }
.gallery-add:disabled { opacity: .5; cursor: wait; }
.gallery-add-plus { font-size: 28px; line-height: 1; font-weight: 300; }
.gallery-add-lbl { font-size: 12px; }
