:root {
  --bg: #f2f3f5;
  --panel: #ffffff;
  --panel-soft: #f7f7f8;
  --ink: #141518;
  --muted: #71757d;
  --line: #e2e4e8;
  --accent: #17181c;
  --blue: #2878ff;
  --orange: #f59b32;
  --violet: #8c5ce7;
  --green: #27a46b;
  --red: #d84c4c;
  --shadow: 0 12px 32px rgba(19, 21, 25, .08);
  --radius: 18px;
}

html[data-theme="dark"] {
  --bg: #0d0e11;
  --panel: #17181d;
  --panel-soft: #1e2026;
  --ink: #f4f4f5;
  --muted: #a3a6ae;
  --line: #2b2e35;
  --accent: #f5f5f5;
  --shadow: 0 12px 32px rgba(0, 0, 0, .3);
}

* { box-sizing: border-box; }
html { font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: var(--ink); background: var(--bg); }
body { margin: 0; min-width: 320px; min-height: 100vh; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
img { max-width: 100%; display: block; }
a { color: inherit; }

.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(420px, .9fr);
  background: var(--panel);
}
.login-brand {
  padding: clamp(36px, 6vw, 92px);
  background:
    radial-gradient(circle at 10% 10%, rgba(255,255,255,.13), transparent 35%),
    linear-gradient(145deg, #0b0c0e 0%, #191b20 65%, #2a2d35 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}
.login-brand::after {
  content: ""; position: absolute; width: 420px; height: 420px; border: 1px solid rgba(255,255,255,.09);
  border-radius: 50%; right: -140px; bottom: -160px; box-shadow: 0 0 0 50px rgba(255,255,255,.025), 0 0 0 100px rgba(255,255,255,.018);
}
.brand-mark { width: min(420px, 80%); filter: invert(1); mix-blend-mode: screen; }
.login-kicker, .eyebrow { text-transform: uppercase; letter-spacing: .16em; font-size: 11px; font-weight: 800; }
.login-brand h1 { font-size: clamp(42px, 6vw, 76px); line-height: .95; max-width: 680px; margin: 18px 0; letter-spacing: -.055em; }
.login-brand p { max-width: 550px; color: #c8c9ce; font-size: 17px; line-height: 1.6; }
.login-form-wrap { padding: clamp(32px, 8vw, 110px); display: flex; flex-direction: column; justify-content: center; background: var(--panel); }
.login-form-wrap h2 { font-size: 34px; margin: 8px 0; letter-spacing: -.04em; }
.login-form-wrap > p { color: var(--muted); margin: 0 0 32px; }
.field { display: grid; gap: 8px; margin-bottom: 17px; }
.field label { font-size: 13px; font-weight: 750; }
.input, .select, .textarea {
  width: 100%; border: 1px solid var(--line); color: var(--ink); background: var(--panel);
  border-radius: 12px; padding: 13px 14px; outline: none; transition: .2s border-color, .2s box-shadow;
}
.input:focus, .select:focus, .textarea:focus { border-color: #777; box-shadow: 0 0 0 3px rgba(100,100,110,.12); }
.textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
.password-wrap { position: relative; }
.password-wrap .input { padding-right: 72px; }
.show-password { position: absolute; right: 9px; top: 8px; border: 0; background: transparent; color: var(--muted); padding: 6px; }
.btn {
  border: 1px solid transparent; border-radius: 12px; padding: 11px 15px; font-weight: 750;
  background: var(--panel-soft); color: var(--ink); display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn:hover { filter: brightness(.97); }
.btn-primary { background: var(--accent); color: var(--panel); }
html[data-theme="dark"] .btn-primary { color: #111; }
.btn-danger { background: #fff0f0; color: var(--red); }
.btn-ghost { border-color: var(--line); background: transparent; }
.btn-sm { padding: 8px 11px; font-size: 13px; border-radius: 10px; }
.btn-block { width: 100%; min-height: 48px; }
.login-meta { display: flex; justify-content: space-between; align-items: center; margin-top: 22px; color: var(--muted); font-size: 12px; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 220px minmax(0, 1fr); }
.sidebar {
  background: #111216; color: #fff; padding: 19px 14px; position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; z-index: 20;
}
.sidebar-logo { width: 150px; filter: invert(1); margin: 3px 8px 25px; }
.nav { display: grid; gap: 7px; }
.nav-btn {
  width: 100%; border: 0; border-radius: 11px; padding: 11px 13px; background: transparent; color: #afb2ba;
  text-align: left; display: flex; gap: 11px; align-items: center; font-weight: 650;
}
.nav-btn:hover, .nav-btn.active { color: #fff; background: #24262c; }
.nav-icon { width: 20px; text-align: center; }
.nav-badge { margin-left: auto; min-width: 21px; height: 21px; padding: 0 6px; border-radius: 99px; background: #fff; color: #111; display: grid; place-items: center; font-size: 11px; font-weight: 850; }
.sidebar-foot { margin-top: auto; border-top: 1px solid #2d2f35; padding-top: 18px; }
.user-chip { display: flex; gap: 10px; align-items: center; padding: 8px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: #fff; color: #111; display: grid; place-items: center; font-weight: 900; }
.user-chip strong, .user-chip small { display: block; }
.user-chip small { color: #9498a2; margin-top: 2px; }
.main { min-width: 0; }
.topbar {
  min-height: 58px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--panel) 92%, transparent);
  backdrop-filter: blur(12px); display: flex; align-items: center; justify-content: space-between; padding: 0 25px;
  position: sticky; top: 0; z-index: 15;
}
.topbar-actions { display: flex; gap: 9px; align-items: center; }
.icon-btn { border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 11px; width: 40px; height: 40px; display: grid; place-items: center; position: relative; }
.notification-dot { position: absolute; width: 8px; height: 8px; border-radius: 50%; background: var(--red); right: 6px; top: 6px; border: 2px solid var(--panel); }
.mobile-menu { display: none; }
.content { padding: 22px 25px 48px; max-width: 1560px; margin: auto; }
.page-head { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 17px; }
.page-head h1 { margin: 3px 0 0; font-size: clamp(25px, 2.5vw, 34px); letter-spacing: -.04em; }
.page-head p { color: var(--muted); margin: 7px 0 0; }
.head-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.head-actions .select { width: auto; min-width: 98px; padding: 8px 10px; }
.month-controls { display:flex; align-items:center; gap:7px; flex-wrap:nowrap; }
.grid { display: grid; gap: 13px; }
.stats-grid { grid-template-columns: repeat(5, minmax(135px, 1fr)); margin-bottom: 13px; }
.stat-card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px; box-shadow: var(--shadow); min-width: 0; }
.stat-top { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 12px; font-weight: 750; }
.stat-icon { width: 31px; height: 31px; border-radius: 9px; background: var(--panel-soft); display: grid; place-items: center; }
.stat-value { font-size: 25px; font-weight: 850; letter-spacing: -.04em; margin-top: 10px; }
.stat-note { color: var(--muted); font-size: 12px; margin-top: 4px; }
.positive { color: var(--green); }
.warning { color: var(--orange); }
.danger { color: var(--red); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { padding: 14px 16px 12px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); }
.card-head h2, .card-head h3 { margin: 0; font-size: 17px; letter-spacing: -.02em; }
.card-body { padding: 16px; }

.client-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.client-card { overflow: hidden; transition: transform .2s, box-shadow .2s; }
.client-card:hover { transform: translateY(-3px); box-shadow: 0 18px 38px rgba(19,21,25,.12); }
.client-logo-wrap { height: 105px; background: #fff; display: grid; place-items: center; padding: 16px 22px; border-bottom: 1px solid var(--line); overflow: hidden; }
.client-logo-wrap img { width: auto; height: auto; max-width: 82%; max-height: 72px; object-fit: contain; }
.client-card-content { padding: 14px; }
.client-title-row { display: flex; justify-content: space-between; gap: 10px; align-items: start; }
.client-title-row h3 { margin: 0; font-size: 15px; }
.client-handle { color: var(--muted); font-size: 13px; margin-top: 4px; }
.pill { display: inline-flex; gap: 6px; align-items: center; border-radius: 99px; padding: 6px 9px; font-size: 11px; font-weight: 800; background: var(--panel-soft); color: var(--muted); }
.pill.open { background: #e9f8f0; color: #187749; }
.pill.closed { background: #f0f1f3; color: #666b74; }
.progress { height: 6px; background: var(--panel-soft); border-radius: 99px; overflow: hidden; margin: 13px 0 7px; }
.progress > span { display: block; height: 100%; background: var(--ink); border-radius: inherit; }
.progress-meta { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; margin-bottom: 17px; }

.dashboard-two { grid-template-columns: minmax(0, 1.9fr) minmax(320px, .72fr); align-items: start; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.toolbar .select { width: auto; min-width: 116px; padding: 9px 12px; }
.calendar { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-left: 1px solid var(--line); border-top: 1px solid var(--line); }
.weekday { padding: 10px; color: var(--muted); font-size: 11px; font-weight: 850; text-transform: uppercase; letter-spacing: .08em; text-align: center; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--panel-soft); }
.day {
  min-height: 105px; padding: 6px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
  background: var(--panel); position: relative; overflow: hidden;
}
.day:hover { background: var(--panel-soft); }
.day.empty { background: color-mix(in srgb, var(--panel-soft) 75%, transparent); }
.day-num { font-size: 12px; font-weight: 850; width: 25px; height: 25px; display: grid; place-items: center; border-radius: 50%; }
.day.today .day-num { background: var(--ink); color: var(--panel); }
.holiday { font-size: 9px; color: var(--red); line-height: 1.2; margin: 2px 0 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.post-chip {
  border: 0; width: 100%; color: var(--ink); background: var(--panel-soft); border-left: 4px solid var(--blue);
  border-radius: 7px; padding: 5px; margin-top: 5px; text-align: left; display: grid; grid-template-columns: 31px minmax(0, 1fr); gap: 6px; align-items: center;
}
.post-chip[data-category="comercial"] { border-left-color: var(--orange); }
.post-chip[data-category="institucional"] { border-left-color: var(--violet); }
.post-thumb { width: 31px; height: 31px; border-radius: 5px; object-fit: cover; background: #ddd; }
.post-chip strong { font-size: 9px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.post-chip small { color: var(--muted); font-size: 8px; }

.phone {
  width: min(100%, 350px); margin: 0 auto; border: 9px solid #17181b; border-radius: 40px; overflow: hidden;
  background: #fff; color: #151515; box-shadow: 0 24px 50px rgba(0,0,0,.19);
}
.phone-top { height: 27px; display: grid; place-items: center; }
.phone-notch { width: 84px; height: 17px; background: #17181b; border-radius: 0 0 14px 14px; }
.ig-header { padding: 9px 13px; display: flex; justify-content: space-between; align-items: center; font-size: 12px; font-weight: 800; }
.ig-profile { display: flex; gap: 12px; padding: 9px 13px 13px; align-items: center; }
.ig-avatar { width: 59px; height: 59px; border-radius: 50%; border: 2px solid #e4e4e4; padding: 6px; object-fit: contain; }
.ig-stats { display: grid; grid-template-columns: repeat(3, 1fr); text-align: center; flex: 1; font-size: 9px; }
.ig-stats strong { display: block; font-size: 13px; }
.ig-bio { padding: 0 13px 12px; font-size: 9px; line-height: 1.4; }
.ig-tabs { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid #eee; height: 34px; text-align: center; align-items: center; color: #777; }
.ig-tabs span:first-child { color: #111; border-top: 1px solid #111; height: 34px; display: grid; place-items: center; }
.ig-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; background: #fff; min-height: 315px; align-content: start; }
.ig-post { aspect-ratio: 1; position: relative; background: #eee; overflow: hidden; border: 0; padding: 0; }
.ig-post img { width: 100%; height: 100%; object-fit: cover; }
.ig-post.draft img { opacity: .48; }
.ig-post-icon { position: absolute; right: 5px; top: 4px; color: #fff; text-shadow: 0 1px 3px #000; font-size: 11px; }
.ig-empty { grid-column: 1/-1; padding: 60px 20px; text-align: center; color: #777; font-size: 11px; }
.phone-nav { height: 38px; display: flex; justify-content: space-around; align-items: center; border-top: 1px solid #eee; font-size: 15px; }
.preview-filter { display: flex; background: var(--panel-soft); border-radius: 10px; padding: 3px; margin-bottom: 17px; }
.preview-filter button { flex: 1; border: 0; background: transparent; color: var(--muted); border-radius: 8px; padding: 7px; font-size: 11px; font-weight: 800; }
.preview-filter button.active { background: var(--panel); color: var(--ink); box-shadow: 0 2px 8px rgba(0,0,0,.08); }

.strategy-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.month-comments { margin-top: 18px; }
.comment { display: flex; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.comment:last-child { border-bottom: 0; }
.comment-avatar { flex: 0 0 32px; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--panel-soft); font-size: 11px; font-weight: 900; }
.comment-body { min-width: 0; }
.comment-meta { font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.comment-text { font-size: 13px; line-height: 1.45; }

.bar-chart { display: grid; gap: 13px; }
.bar-row { display: grid; grid-template-columns: 120px 1fr 25px; gap: 10px; align-items: center; font-size: 12px; }
.bar-track { height: 9px; background: var(--panel-soft); border-radius: 99px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: inherit; }
.charts-pair { grid-template-columns: repeat(2,minmax(0,1fr)); margin-top:13px; }
.print-only { display:none; }
.print-breakdown { margin-top:24px; }
.print-plate { display:grid; grid-template-columns:170px 1fr; gap:18px; padding:16px 0; border-bottom:1px solid #ddd; break-inside:avoid; }
.print-plate img { width:170px; height:170px; object-fit:cover; border-radius:8px; }
.print-plate h3 { margin:0 0 6px; font-size:16px; }
.print-copy { white-space:pre-wrap; line-height:1.5; font-size:12px; }

.task-list { display: grid; gap: 10px; }
.task {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 11px; align-items: center;
  padding: 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--panel);
}
.task-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--orange); }
.task.resolved .task-dot { background: var(--green); }
.task strong { font-size: 13px; }
.task p { color: var(--muted); font-size: 12px; margin: 4px 0 0; }
.ticket-actions { display: flex; gap: 7px; flex-wrap: wrap; justify-content: end; }
.ticket-stats { grid-template-columns: repeat(3,minmax(140px,220px)); margin-bottom: 16px; }
.ticket-message { padding: 12px 14px; border-radius: 12px; background: var(--panel-soft); margin-bottom: 10px; max-width: 90%; }
.ticket-message.mine { background: var(--ink); color: var(--panel); margin-left: auto; }
.ticket-message .comment-meta { color: inherit; opacity: .65; }
.ticket-filter { display:flex; gap:4px; padding:3px; background:var(--panel-soft); border-radius:10px; }
.empty-state { padding: 58px 20px; text-align: center; color: var(--muted); }
.empty-state .big-icon { font-size: 38px; margin-bottom: 12px; }

.drawer-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.42); z-index: 49; animation: fade .2s; }
.drawer {
  position: fixed; right: 0; top: 0; height: 100vh; width: min(620px, 100%); background: var(--panel); z-index: 50;
  box-shadow: -20px 0 50px rgba(0,0,0,.18); overflow-y: auto; animation: slide .25s ease-out;
}
.drawer-head { position: sticky; top: 0; z-index: 2; padding: 18px 22px; border-bottom: 1px solid var(--line); background: var(--panel); display: flex; justify-content: space-between; align-items: center; }
.drawer-head h2 { margin: 0; font-size: 20px; }
.drawer-body { padding: 22px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.form-grid .span-2 { grid-column: 1/-1; }
.upload-zone {
  border: 1.5px dashed var(--line); border-radius: 13px; padding: 25px; text-align: center; color: var(--muted);
  background: var(--panel-soft); position: relative;
}
.upload-zone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.media-list { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 10px; }
.media-item { position: relative; aspect-ratio: 1; background: var(--panel-soft); border-radius: 9px; overflow: hidden; }
.media-item img { width: 100%; height: 100%; object-fit: cover; }
.media-item button { position: absolute; right: 3px; top: 3px; border: 0; border-radius: 50%; width: 22px; height: 22px; background: rgba(0,0,0,.68); color: #fff; }
.drawer-actions { display: flex; justify-content: space-between; gap: 10px; border-top: 1px solid var(--line); margin-top: 22px; padding-top: 18px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 22px 0 12px; }
.tab { border: 0; background: transparent; color: var(--muted); padding: 10px 12px; border-bottom: 2px solid transparent; font-weight: 750; font-size: 12px; }
.tab.active { color: var(--ink); border-bottom-color: var(--ink); }
.history-item { border-left: 2px solid var(--line); padding: 0 0 17px 14px; margin-left: 6px; font-size: 12px; }
.history-item strong { display: block; margin-bottom: 4px; }
.history-item small { color: var(--muted); }
.copy-box { white-space: pre-wrap; background: var(--panel-soft); border-radius: 12px; padding: 15px; font-size: 13px; line-height: 1.55; }

.toast-root { position: fixed; right: 20px; bottom: 20px; z-index: 100; display: grid; gap: 8px; }
.toast { padding: 12px 16px; border-radius: 11px; background: #15161a; color: #fff; box-shadow: var(--shadow); font-size: 13px; animation: toastIn .25s; }
.toast.error { background: #a42d2d; }

@keyframes slide { from { transform: translateX(100%); } }
@keyframes fade { from { opacity: 0; } }
@keyframes toastIn { from { transform: translateY(12px); opacity: 0; } }

@media (max-width: 1180px) {
  .stats-grid { grid-template-columns: repeat(3, 1fr); }
  .client-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-two { grid-template-columns: 1fr; }
  .phone { width: min(340px, 100%); }
}
@media (max-width: 820px) {
  .login-page { grid-template-columns: 1fr; }
  .login-brand { min-height: 330px; padding: 34px; }
  .login-brand h1 { font-size: 46px; }
  .login-form-wrap { padding: 42px 25px; }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; transform: translateX(-100%); transition: transform .2s; width: 248px; }
  .sidebar.open { transform: translateX(0); }
  .mobile-menu { display: grid; }
  .content { padding: 23px 16px 50px; }
  .topbar { padding: 0 16px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .client-grid { grid-template-columns: 1fr; }
  .page-head { align-items: start; flex-direction: column; }
  .calendar-wrap { overflow-x: auto; }
  .calendar { min-width: 760px; }
  .strategy-grid { grid-template-columns: 1fr; }
  .charts-pair { grid-template-columns: 1fr; }
  .month-controls { flex-wrap:wrap; }
}
@media (max-width: 540px) {
  .login-brand { min-height: 270px; }
  .login-brand h1 { font-size: 37px; }
  .login-brand p { font-size: 14px; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card { padding: 14px; }
  .stat-value { font-size: 26px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
  .drawer { width: 100%; }
  .task { grid-template-columns: auto minmax(0, 1fr); }
  .task > :last-child { grid-column: 2; }
}

@media print {
  .sidebar, .topbar, .no-print, .drawer, .drawer-backdrop { display: none !important; }
  .app-shell { display: block; }
  .content { padding: 0; max-width: none; }
  body, html { background: #fff; color: #111; }
  .card, .stat-card { box-shadow: none; break-inside: avoid; }
  .dashboard-two { display:block; }
  .dashboard-two > .grid { display:none !important; }
  .calendar { min-width: 0; }
  .day { min-height: 100px; }
  .print-only { display:block !important; }
  .page-head .head-actions, .stats-grid, .charts-pair { display:none !important; }
  .print-report-head { display:flex !important; align-items:center; justify-content:space-between; border-bottom:2px solid #111; padding-bottom:14px; margin-bottom:18px; }
  .print-report-head img { width:150px; max-height:55px; object-fit:contain; }
}
