:root {
  color-scheme: dark;
  --bg: #090909;
  --surface: #141310;
  --surface-2: #1c1914;
  --glass: rgba(23, 21, 17, .86);
  --text: #f6f0e5;
  --muted: #a99f90;
  --line: rgba(232, 165, 42, .22);
  --accent: #e8a52a;
  --accent-2: #ffbf4f;
  --accent-rgb: 232, 165, 42;
  --success: #5bd19a;
  --danger: #f06f62;
  --warning: #f1b95a;
  --shadow: 0 26px 70px rgba(0, 0, 0, .38);
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #f5efe4;
  --surface: #fffdf8;
  --surface-2: #f8efe1;
  --glass: rgba(255, 253, 248, .9);
  --text: #211a12;
  --muted: #776b5c;
  --line: rgba(var(--accent-rgb), .24);
  --success: #198454;
  --danger: #be4239;
  --warning: #a86b0b;
  --shadow: 0 24px 60px rgba(80, 55, 18, .14);
}

html[data-accent="gold"] { --accent: #e8a52a; --accent-2: #ffbf4f; --accent-rgb: 232, 165, 42; }
html[data-accent="amber"] { --accent: #e29a19; --accent-2: #ffc85f; --accent-rgb: 226, 154, 25; }
html[data-accent="copper"] { --accent: #c97139; --accent-2: #e9a36d; --accent-rgb: 201, 113, 57; }
html[data-accent="emerald"] { --accent: #25a974; --accent-2: #65d6aa; --accent-rgb: 37, 169, 116; }
html[data-accent="blue"] { --accent: #4d83e4; --accent-2: #77a9ff; --accent-rgb: 77, 131, 228; }
html[data-accent="violet"] { --accent: #8463dd; --accent-2: #ac8cf2; --accent-rgb: 132, 99, 221; }
html[data-accent="rose"] { --accent: #cd6685; --accent-2: #e99ab1; --accent-rgb: 205, 102, 133; }

html[data-theme="dark"][data-background="black"] { --bg: #030303; --surface: #0d0d0d; --surface-2: #151515; --glass: rgba(12, 12, 12, .9); }
html[data-theme="dark"][data-background="slate"] { --bg: #0c1117; --surface: #141b23; --surface-2: #1a2430; --glass: rgba(18, 25, 33, .88); }
html[data-theme="dark"][data-background="sand"] { --bg: #17130d; --surface: #211b12; --surface-2: #2b2216; --glass: rgba(31, 25, 17, .88); }
html[data-theme="dark"][data-background="cream"] { --bg: #18140f; --surface: #211d17; --surface-2: #2a241c; --glass: rgba(31, 27, 21, .88); }
html[data-theme="dark"][data-background="mist"] { --bg: #111315; --surface: #191d20; --surface-2: #22272b; --glass: rgba(23, 27, 30, .88); }
html[data-theme="light"][data-background="graphite"] { --bg: #ece8df; --surface: #faf8f2; --surface-2: #f1ece2; --glass: rgba(250, 248, 242, .9); }
html[data-theme="light"][data-background="black"] { --bg: #e4e5e6; --surface: #f8f8f7; --surface-2: #ededeb; --glass: rgba(248, 248, 247, .9); }
html[data-theme="light"][data-background="slate"] { --bg: #e8edf2; --surface: #fbfcfd; --surface-2: #eef3f6; --glass: rgba(250, 252, 253, .9); }
html[data-theme="light"][data-background="sand"] { --bg: #eee1cb; --surface: #fffaf1; --surface-2: #f7ead6; --glass: rgba(255, 250, 241, .9); }
html[data-theme="light"][data-background="cream"] { --bg: #f7f0e4; --surface: #fffdf9; --surface-2: #faf1e4; --glass: rgba(255, 253, 249, .9); }
html[data-theme="light"][data-background="mist"] { --bg: #edf1f1; --surface: #fbfdfc; --surface-2: #eff4f3; --glass: rgba(251, 253, 252, .9); }

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; background: var(--bg); color: var(--text); }
body { min-height: 100vh; overflow-x: hidden; background: radial-gradient(circle at 78% 2%, rgba(var(--accent-rgb), .1), transparent 34%), var(--bg); }
button, input, textarea, select { font: inherit; }
button { color: inherit; }
.hidden { display: none !important; }
.ambient { position: fixed; pointer-events: none; border-radius: 50%; filter: blur(90px); opacity: .25; }
.ambient-one { width: 35vw; height: 35vw; background: var(--accent); left: -20vw; bottom: -10vw; }
.ambient-two { width: 20vw; height: 20vw; background: var(--accent); right: 2vw; top: -8vw; opacity: .1; }
.glass { background: var(--glass); border: 1px solid var(--line); box-shadow: var(--shadow); backdrop-filter: blur(20px); }

.brand-lockup { display: flex; align-items: center; gap: 14px; }
.brand-mark { width: 48px; height: 48px; display: flex; align-items: flex-end; justify-content: center; gap: 3px; padding: 10px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.brand-mark span { width: 6px; border-radius: 2px 2px 0 0; background: linear-gradient(var(--accent-2), var(--accent)); }
.brand-mark span:nth-child(1) { height: 16px; }
.brand-mark span:nth-child(2) { height: 25px; }
.brand-mark span:nth-child(3) { height: 20px; }
.brand-lockup strong { display: block; font-size: 21px; letter-spacing: .01em; }
.brand-lockup em { font-style: normal; color: var(--accent); }
.brand-lockup small { display: block; color: var(--muted); font-size: 10px; letter-spacing: .2em; text-transform: uppercase; margin-top: 3px; }

.login-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(260px, 440px) minmax(420px, 660px); align-items: center; justify-content: center; gap: 8vw; padding: 60px; }
.login-brand { align-self: start; margin-top: 4vh; }
.login-card { border-radius: 32px; padding: 64px 72px; position: relative; overflow: hidden; }
.login-card::before { content: ""; position: absolute; width: 320px; height: 320px; background: radial-gradient(circle, rgba(var(--accent-rgb), .18), transparent 65%); right: -120px; bottom: -140px; }
.eyebrow { display: block; color: var(--accent); font-size: 11px; font-weight: 800; letter-spacing: .18em; }
.login-card h1 { font-size: 54px; line-height: 1.05; margin: 20px 0; }
.login-card > p { color: var(--muted); font-size: 16px; line-height: 1.6; margin: 0 0 36px; max-width: 520px; }

.form-stack, .dialog, .drawer-form, .settings-form { display: flex; flex-direction: column; gap: 18px; }
label { display: flex; flex-direction: column; gap: 8px; color: var(--muted); font-size: 12px; font-weight: 700; }
input, textarea, select { width: 100%; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); color: var(--text); padding: 14px 16px; outline: none; transition: .2s; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .12); }
input:disabled { opacity: .7; cursor: not-allowed; }
textarea { resize: vertical; }
.button { border: 1px solid transparent; border-radius: 13px; padding: 13px 18px; font-weight: 800; cursor: pointer; transition: .2s; white-space: nowrap; }
.button:hover { transform: translateY(-1px); }
.button:disabled { opacity: .5; cursor: wait; transform: none; }
.button.primary { background: linear-gradient(110deg, var(--accent-2), var(--accent)); color: #1b1205; box-shadow: 0 12px 28px rgba(var(--accent-rgb), .24); }
.button.secondary { background: var(--surface); border-color: var(--line); color: var(--text); }
.button.danger { background: rgba(211, 66, 53, .1); border-color: rgba(240, 111, 98, .35); color: var(--danger); }
.small-button { padding: 9px 12px; border-radius: 10px; font-size: 11px; }
.form-error { min-height: 18px; color: var(--danger); font-size: 12px; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 250px 1fr; }
.sidebar { position: fixed; inset: 16px auto 16px 16px; width: 230px; border-radius: 24px; padding: 20px 14px; display: flex; flex-direction: column; z-index: 10; }
.brand { padding: 3px 8px 25px; }
.brand .brand-mark { width: 40px; height: 40px; padding: 8px; }
.brand strong { font-size: 15px; }
.brand small { font-size: 8px; }
.sidebar nav { display: flex; flex-direction: column; gap: 7px; overflow: auto; padding-right: 2px; scrollbar-width: thin; scrollbar-color: var(--accent) transparent; }
.nav-item { position: relative; border: 1px solid transparent; background: transparent; color: var(--muted); border-radius: 12px; display: flex; align-items: center; gap: 12px; padding: 12px 13px; cursor: pointer; text-align: left; font-weight: 700; }
.nav-item i { font-style: normal; color: var(--accent); font-size: 17px; width: 19px; text-align: center; }
.nav-item:hover { background: var(--surface); }
.nav-item.active { color: var(--text); background: linear-gradient(90deg, rgba(var(--accent-rgb), .2), rgba(var(--accent-rgb), .06)); border-color: var(--line); }
.nav-badge { margin-left: auto; min-width: 20px; height: 20px; display: grid; place-items: center; border-radius: 99px; background: var(--accent); color: #1b1205; font-size: 9px; }
.sidebar-footer { margin-top: auto; border-top: 1px solid var(--line); padding: 16px 6px 2px; }
.logout-button { width: 100%; border: 0; background: transparent; color: var(--muted); font-weight: 700; cursor: pointer; text-align: left; padding: 8px; }

.workspace { grid-column: 2; padding: 24px 28px 50px 18px; min-width: 0; }
.topbar { min-height: 76px; display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; gap: 20px; }
.topbar h2 { font-size: 27px; margin: 5px 0 0; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.icon-button { width: 42px; height: 42px; display: inline-grid; place-items: center; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--text); cursor: pointer; font-size: 20px; flex: 0 0 auto; }
.icon-button.small { width: 36px; height: 36px; border-radius: 10px; }
.add-button { background: linear-gradient(135deg, var(--accent-2), var(--accent)); color: #1b1205; border: 0; font-size: 25px; }
.notification-button { position: relative; font-size: 24px; }
.notification-count { position: absolute; right: -5px; top: -6px; min-width: 20px; height: 20px; padding: 0 5px; display: grid; place-items: center; border: 2px solid var(--bg); border-radius: 99px; background: var(--accent); color: #1b1205; font-size: 9px; font-weight: 900; }
.profile-menu-wrap { position: relative; }
.user-pill { min-width: 220px; display: flex; align-items: center; gap: 10px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); cursor: pointer; text-align: left; }
.user-pill > i { margin-left: auto; color: var(--muted); font-style: normal; }
.user-pill strong, .user-pill small { display: block; }
.user-pill strong { font-size: 12px; }
.user-pill small { font-size: 9px; color: var(--muted); margin-top: 2px; }
.user-avatar, .avatar-preview { width: 36px; height: 36px; overflow: hidden; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(135deg, var(--accent-2), var(--accent)); color: #211506; font-weight: 900; border: 0; }
.user-avatar img, .avatar-preview img { width: 100%; height: 100%; object-fit: cover; }
.profile-menu { position: absolute; right: 0; top: calc(100% + 8px); width: 220px; padding: 7px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); z-index: 25; }
.profile-menu button { width: 100%; border: 0; border-radius: 10px; padding: 11px 12px; background: transparent; color: var(--text); cursor: pointer; text-align: left; font-weight: 700; }
.profile-menu button:hover { background: var(--surface-2); }

.page-section { display: none; }
.page-section.active { display: block; animation: page-in .28s ease both; }
@keyframes page-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.notice { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 13px 16px; border-radius: 14px; margin-bottom: 14px; }
.notice.warning { background: rgba(241, 185, 90, .08); border: 1px solid rgba(241, 185, 90, .25); }
.notice strong, .notice span { display: block; }
.notice strong { font-size: 12px; }
.notice span { font-size: 10px; color: var(--muted); margin-top: 3px; }

.summary-grid { display: grid; grid-template-columns: repeat(6, minmax(130px, 1fr)); gap: 12px; margin-bottom: 14px; }
.summary-card { border: 1px solid var(--line); border-radius: 16px; background: var(--glass); padding: 17px; min-height: 110px; position: relative; overflow: hidden; }
.summary-card::after { content: ""; position: absolute; width: 80px; height: 80px; border-radius: 50%; background: var(--accent); opacity: .06; right: -25px; bottom: -25px; }
.summary-card span { color: var(--muted); font-size: 10px; font-weight: 700; }
.summary-card strong { display: block; font-size: 28px; margin: 11px 0 3px; }
.summary-card small { color: var(--muted); font-size: 9px; }

.panel { border-radius: 18px; overflow: hidden; }
.panel-heading, .toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 20px; border-bottom: 1px solid var(--line); }
.compact-heading { padding: 17px 18px; }
.panel-heading h3 { font-size: 17px; margin: 6px 0 0; }
.heading-actions { display: flex; align-items: center; gap: 7px; }
.overview-grid { display: grid; grid-template-columns: minmax(540px, 1.5fr) minmax(300px, .8fr); gap: 14px; }
.calendar-panel { grid-row: span 2; }
.alerts-panel { min-height: 250px; }
.calendar-weekdays { display: grid; grid-template-columns: repeat(7, 1fr); padding: 12px 14px 6px; color: var(--muted); font-size: 9px; text-align: center; text-transform: uppercase; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); padding: 8px 14px 16px; }
.calendar-day { position: relative; min-height: 74px; border: 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: transparent; color: var(--text); cursor: pointer; }
.calendar-day:nth-child(7n+1) { border-left: 1px solid var(--line); }
.calendar-day:nth-child(-n+7) { border-top: 1px solid var(--line); }
.calendar-day.outside { color: var(--muted); opacity: .55; }
.calendar-day.today::after { content: ""; position: absolute; left: 50%; bottom: 10px; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent); }
.calendar-day.selected { background: rgba(var(--accent-rgb), .16); box-shadow: inset 0 0 0 1px var(--accent); color: var(--text); }
.calendar-day b { position: absolute; right: 7px; top: 7px; min-width: 18px; height: 18px; border-radius: 99px; display: grid; place-items: center; background: var(--accent); color: #1b1205; font-size: 8px; }
.segmented { display: inline-flex; gap: 3px; margin: 12px 16px 4px; padding: 3px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-2); }
.segmented button { border: 0; border-radius: 8px; padding: 8px 13px; background: transparent; color: var(--muted); cursor: pointer; font-size: 10px; font-weight: 800; }
.segmented button.active { background: var(--accent); color: #211506; }
.day-tasks { padding: 10px 16px 16px; max-height: 290px; overflow: auto; }
.day-task { display: flex; align-items: center; gap: 11px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.day-task:last-child { border-bottom: 0; }
.day-task > div { cursor: pointer; flex: 1; }
.day-task strong, .day-task span { display: block; }
.day-task strong { font-size: 11px; }
.day-task span { color: var(--muted); font-size: 9px; margin-top: 3px; }
.day-task.completed { opacity: .55; }
.day-task.completed strong { text-decoration: line-through; }
.task-check { width: 25px; height: 25px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--accent); cursor: pointer; }

.alerts-list, .lead-list { padding: 10px; }
.alert-item { display: flex; gap: 11px; padding: 13px; border-bottom: 1px solid var(--line); }
.alert-item:last-child { border-bottom: 0; }
.alert-dot { width: 9px; height: 9px; flex: 0 0 auto; border-radius: 50%; margin-top: 5px; background: var(--accent); }
.alert-item.critical .alert-dot { background: var(--danger); }
.alert-item.warning .alert-dot { background: var(--warning); }
.alert-item.success .alert-dot { background: var(--success); }
.alert-item strong { font-size: 12px; }
.alert-item p { font-size: 10px; color: var(--muted); line-height: 1.45; margin: 4px 0 0; }

.search-field { display: flex; align-items: center; gap: 10px; flex: 1; max-width: 760px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.search-field span { padding-left: 14px; color: var(--accent); }
.search-field input { border: 0; background: transparent; box-shadow: none; }
.compact-select { width: auto; min-width: 170px; padding: 12px 14px; }
.status-pill, .count-pill { display: inline-flex; align-items: center; justify-content: center; min-height: 28px; padding: 5px 10px; border: 1px solid var(--line); border-radius: 99px; background: var(--surface-2); color: var(--muted); font-size: 10px; font-weight: 800; }
.status-new { color: var(--accent); }
.status-in_progress, .status-active { color: var(--success); }
.status-waiting { color: var(--warning); }
.status-inactive { color: var(--muted); }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th { text-transform: uppercase; letter-spacing: .1em; font-size: 9px; color: var(--muted); font-weight: 800; background: var(--surface-2); }
th, td { text-align: center; padding: 13px 15px; border-bottom: 1px solid var(--line); }
td { font-size: 11px; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: rgba(var(--accent-rgb), .05); }
td:first-child strong, td:first-child small { display: block; text-align: left; }
td:first-child small { color: var(--muted); font-size: 9px; margin-top: 3px; }
.lead-item { width: 100%; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--text); display: grid; grid-template-columns: 1.4fr 1fr 1fr auto; gap: 18px; align-items: center; padding: 15px; cursor: pointer; text-align: left; }
.lead-item:last-child { border-bottom: 0; }
.lead-item:hover { background: rgba(var(--accent-rgb), .05); border-radius: 12px; }
.lead-item strong, .lead-item small { display: block; }
.lead-item small { color: var(--muted); font-size: 10px; margin-top: 4px; }
.empty-state { padding: 55px 20px; text-align: center; color: var(--muted); font-size: 12px; }
.compact-empty { padding: 30px 16px; }

.tickets-toolbar { display: flex; align-items: center; gap: 10px; border-radius: 16px; padding: 10px; margin-bottom: 14px; }
.kanban { display: grid; grid-template-columns: repeat(5, minmax(240px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: start; }
.kanban-column { min-height: 540px; border: 1px solid var(--line); border-radius: 17px; background: color-mix(in srgb, var(--surface) 88%, transparent); transition: .2s; }
.kanban-column.drag-over { border-color: var(--accent); background: rgba(var(--accent-rgb), .08); }
.kanban-column > header { display: flex; align-items: center; gap: 9px; padding: 14px; border-bottom: 1px solid var(--line); }
.kanban-column > header strong { font-size: 12px; }
.kanban-column > header b { margin-left: auto; width: 25px; height: 25px; display: grid; place-items: center; border-radius: 99px; background: var(--surface-2); color: var(--muted); font-size: 9px; }
.kanban-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); }
.kanban-dot.status-new { background: var(--accent); }
.kanban-dot.status-in_progress { background: var(--success); }
.kanban-dot.status-waiting { background: var(--warning); }
.kanban-dot.status-resolved { background: #6aa8ef; }
.kanban-cards { display: flex; flex-direction: column; gap: 9px; padding: 9px; }
.ticket-card { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); padding: 13px; cursor: pointer; box-shadow: 0 10px 24px rgba(0, 0, 0, .1); }
.ticket-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.ticket-card.priority-urgent { border-color: rgba(240, 111, 98, .6); }
.ticket-card.priority-high { border-left: 3px solid var(--warning); }
.ticket-card-top, .ticket-meta, .ticket-card footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ticket-card-top span, .ticket-card-top b, .ticket-meta span, .ticket-card footer { color: var(--muted); font-size: 8px; }
.ticket-card-top b { color: var(--accent); }
.ticket-card h4 { font-size: 12px; line-height: 1.35; margin: 10px 0 5px; }
.ticket-card p { color: var(--muted); font-size: 9px; margin: 0 0 11px; }
.ticket-meta { padding: 8px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.ticket-card footer { padding-top: 10px; }
.kanban-empty { padding: 28px 8px; color: var(--muted); text-align: center; font-size: 10px; }

.users-tabs { margin: 14px 20px; }
.toolbar.slim { padding-top: 10px; }
.roles-grid { display: grid; grid-template-columns: repeat(2, minmax(280px, 1fr)); gap: 14px; padding: 20px; }
.role-card { display: grid; grid-template-columns: 58px 1fr; gap: 16px; padding: 22px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface-2); }
.role-icon { width: 54px; height: 54px; border-radius: 15px; display: grid; place-items: center; background: rgba(var(--accent-rgb), .12); color: var(--accent); font-size: 25px; }
.role-card h3 { margin: 7px 0; font-size: 18px; }
.role-card p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.55; }
.permission-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 15px; }
.permission-chips span { border: 1px solid var(--line); border-radius: 99px; padding: 5px 8px; color: var(--muted); font-size: 8px; }

.drawer { position: fixed; top: 0; right: 0; width: min(540px, 94vw); height: 100vh; background: var(--surface); border-left: 1px solid var(--line); z-index: 40; transform: translateX(102%); transition: .28s ease; box-shadow: -30px 0 60px rgba(0, 0, 0, .3); display: flex; flex-direction: column; }
.drawer.open { transform: translateX(0); }
.drawer-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, .48); z-index: 30; opacity: 0; pointer-events: none; transition: .25s; }
.drawer-backdrop.open { opacity: 1; pointer-events: auto; }
.drawer-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 22px; border-bottom: 1px solid var(--line); }
.drawer-heading h3 { font-size: 21px; margin: 6px 0 0; }
.drawer-content { padding: 20px; overflow: auto; flex: 1; }
.drawer-metrics { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.drawer-metric { padding: 14px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface-2); }
.drawer-metric span { font-size: 9px; color: var(--muted); text-transform: uppercase; letter-spacing: .09em; }
.drawer-metric strong { display: block; font-size: 17px; margin-top: 6px; }
.drawer-details { margin-top: 16px; border-top: 1px solid var(--line); }
.drawer-detail { display: flex; justify-content: space-between; gap: 15px; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 11px; }
.drawer-detail span { color: var(--muted); }
.drawer-actions { padding: 20px; border-top: 1px solid var(--line); background: var(--surface-2); }
.subscription-controls { display: grid; grid-template-columns: 1.2fr .7fr .9fr 1fr; gap: 9px; margin: 14px 0 0; padding: 13px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); min-width: 0; }
.subscription-controls legend { padding: 0 7px; color: var(--accent); font-size: 9px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.subscription-controls input, .subscription-controls select { padding: 10px 11px; border-radius: 10px; }
.action-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 12px; }
.action-grid .danger { grid-column: 1 / -1; }
.command-result { min-height: 18px; font-size: 11px; color: var(--muted); margin-top: 10px; }
.command-result.error { color: var(--danger); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.switch-row { flex-direction: row; align-items: center; padding: 13px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface-2); }
.switch-row input { width: 18px; height: 18px; accent-color: var(--accent); }

.notification-toolbar { padding: 12px 20px; border-bottom: 1px solid var(--line); text-align: right; }
.notification-list { padding: 8px; overflow: auto; }
.notification-item { width: 100%; display: grid; grid-template-columns: 38px 1fr; gap: 10px; padding: 13px; border: 0; border-bottom: 1px solid var(--line); border-radius: 11px; background: transparent; color: var(--text); cursor: pointer; text-align: left; }
.notification-item:hover { background: var(--surface-2); }
.notification-item.unread { background: rgba(var(--accent-rgb), .07); }
.notification-icon { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 11px; color: var(--accent); }
.notification-item strong { font-size: 11px; }
.notification-item p { margin: 4px 0; color: var(--muted); font-size: 9px; line-height: 1.45; }
.notification-item time { color: var(--muted); font-size: 8px; }

.settings-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 14px; align-items: start; }
.settings-form { padding: 20px; }
.settings-security { grid-column: 2; }
.avatar-editor { display: flex; align-items: center; gap: 14px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.avatar-preview { width: 68px; height: 68px; flex: 0 0 auto; font-size: 22px; cursor: pointer; }
.avatar-editor strong, .avatar-editor span { display: block; }
.avatar-editor span { color: var(--muted); font-size: 10px; margin-top: 5px; }
.profile-readonly { display: flex; justify-content: space-between; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--line); font-size: 11px; }
.profile-readonly span { color: var(--muted); }
.align-right { align-self: flex-end; }
.field-title { display: block; color: var(--muted); font-size: 11px; font-weight: 800; margin-bottom: 9px; }
.choice-row, .swatch-row, .background-row { display: grid; gap: 8px; }
.choice-row { grid-template-columns: 1fr 1fr; }
.choice-row button, .swatch-row button, .background-row button { border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); color: var(--muted); cursor: pointer; font-size: 10px; font-weight: 800; padding: 11px; }
.choice-row button.active, .swatch-row button.active, .background-row button.active { border-color: var(--accent); color: var(--text); box-shadow: inset 0 0 0 1px var(--accent); }
.swatch-row { grid-template-columns: repeat(4, 1fr); }
.swatch-row span { width: 22px; height: 22px; display: block; margin: 0 auto 6px; border-radius: 50%; background: var(--accent); }
.swatch-row .swatch-gold { background: #e8a52a; } .swatch-row .swatch-amber { background: #f3b13e; } .swatch-row .swatch-copper { background: #d68142; }
.swatch-row .swatch-emerald { background: #2eb67d; } .swatch-row .swatch-blue { background: #4d8df7; } .swatch-row .swatch-violet { background: #8f6bea; } .swatch-row .swatch-rose { background: #db6f8f; }
.background-row { grid-template-columns: repeat(3, 1fr); }
.background-row button::before { content: ""; display: block; height: 25px; margin-bottom: 7px; border-radius: 7px; background: #171717; }
.background-row .background-black::before { background: #050505; } .background-row .background-slate::before { background: #26313d; } .background-row .background-sand::before { background: #cbae82; }
.background-row .background-cream::before { background: #f2e9d8; } .background-row .background-mist::before { background: #cdd8d8; }
.muted-copy { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.55; }

.ticket-detail-page { margin-top: -96px; position: relative; z-index: 4; }
.app-shell.detail-open .topbar { visibility: hidden; pointer-events: none; }
.detail-header { min-height: 80px; display: flex; align-items: center; gap: 14px; border-radius: 18px; padding: 12px 16px; margin-bottom: 14px; }
.detail-header h2 { font-size: 20px; margin: 4px 0 0; }
.detail-header .status-pill { margin-left: auto; }
.detail-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 14px; align-items: start; }
.detail-main { display: flex; flex-direction: column; gap: 14px; }
.detail-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; padding: 20px; }
.detail-form .span-two { grid-column: 1 / -1; }
.compact-fields { padding-top: 15px; }
.history-panel { position: sticky; top: 18px; max-height: calc(100vh - 36px); }
.comment-form { padding: 14px; border-bottom: 1px solid var(--line); }
.comment-form .button { margin-top: 9px; float: right; }
.ticket-history { padding: 10px 16px 20px; max-height: calc(100vh - 300px); overflow: auto; }
.history-item { display: grid; grid-template-columns: 34px 1fr; gap: 10px; position: relative; padding: 12px 0; }
.history-item:not(:last-child)::after { content: ""; position: absolute; left: 16px; top: 43px; bottom: -5px; width: 1px; background: var(--line); }
.history-icon { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; background: var(--surface); color: var(--accent); z-index: 1; }
.history-item time, .history-item strong, .history-item p, .history-item small { display: block; }
.history-item time { color: var(--muted); font-size: 8px; }
.history-item strong { font-size: 10px; margin-top: 3px; }
.history-item p { margin: 4px 0 0; font-size: 10px; line-height: 1.45; }
.history-item small { color: var(--accent); font-size: 8px; margin-top: 5px; }

.dialog-backdrop { position: fixed; inset: 0; z-index: 80; background: rgba(0, 0, 0, .66); display: grid; place-items: center; padding: 20px; }
.dialog { width: min(480px, 100%); padding: 0 24px 24px; border-radius: 20px; }
.dialog .drawer-heading { margin: 0 -24px 2px; }
.toast { position: fixed; right: 28px; bottom: 28px; z-index: 100; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 13px 16px; box-shadow: var(--shadow); font-size: 11px; opacity: 0; transform: translateY(15px); pointer-events: none; transition: .25s; }
.toast.visible { opacity: 1; transform: translateY(0); }

@media (max-width: 1450px) {
  .summary-grid { grid-template-columns: repeat(3, 1fr); }
  .kanban { grid-template-columns: repeat(5, 260px); }
}
@media (max-width: 1120px) {
  .overview-grid, .settings-grid, .detail-layout { grid-template-columns: 1fr; }
  .calendar-panel { grid-row: auto; }
  .settings-security { grid-column: auto; }
  .history-panel { position: static; max-height: none; }
  .ticket-history { max-height: 500px; }
  .roles-grid { grid-template-columns: 1fr; }
  .subscription-controls { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 800px) {
  .login-shell { grid-template-columns: 1fr; padding: 22px; }
  .login-brand { margin: 0; }
  .login-card { padding: 38px 26px; }
  .login-card h1 { font-size: 40px; }
  .app-shell { display: block; }
  .sidebar { position: fixed; inset: auto 10px 10px; width: auto; height: 68px; flex-direction: row; padding: 8px; align-items: center; }
  .brand.compact, .sidebar-footer { display: none; }
  .sidebar nav { flex-direction: row; width: 100%; justify-content: space-around; overflow-x: auto; }
  .nav-item { padding: 10px; min-width: 46px; justify-content: center; }
  .nav-item i { font-size: 19px; }
  .nav-item span { display: none; }
  .nav-badge { position: absolute; right: 0; top: 0; }
  .workspace { padding: 18px 14px 94px; }
  .topbar { align-items: flex-start; }
  .user-pill { min-width: 0; }
  .user-pill div, .user-pill > i { display: none; }
  .summary-grid { grid-template-columns: repeat(2, 1fr); }
  .overview-grid { display: block; }
  .overview-grid > * { margin-bottom: 14px; }
  .calendar-day { min-height: 53px; }
  .toolbar, .tickets-toolbar { flex-wrap: wrap; }
  .search-field { max-width: none; min-width: 100%; }
  .compact-select { flex: 1; }
  .lead-item { grid-template-columns: 1fr; }
  .detail-form, .compact-fields { grid-template-columns: 1fr; }
  .detail-form .span-two { grid-column: auto; }
  .ticket-detail-page { margin-top: -88px; }
  .form-row { grid-template-columns: 1fr; }
}
@media (max-width: 460px) {
  .summary-card { padding: 14px; }
  .summary-card strong { font-size: 24px; }
  .login-card h1 { font-size: 33px; }
  .topbar h2 { font-size: 22px; }
  .calendar-grid { padding-left: 8px; padding-right: 8px; }
  .calendar-day { min-height: 46px; }
  .swatch-row, .background-row { grid-template-columns: repeat(2, 1fr); }
}
