:root {
  --sidebar: #1e293b;
  --sidebar-deep: #0f172a;
  --sidebar-muted: #94a3b8;
  --content: #f8fafc;
  --surface: #ffffff;
  --surface-soft: #f1f5f9;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --primary: #3b82f6;
  --primary-dark: #2563eb;
  --primary-soft: #eff6ff;
  --success: #16a34a;
  --success-soft: #dcfce7;
  --warning: #d97706;
  --warning-soft: #fef3c7;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --info: #0891b2;
  --sidebar-width: 250px;
  --sidebar-collapsed: 82px;
  --topbar-height: 72px;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow: 0 10px 30px rgba(15, 23, 42, .08);
  --shadow-lg: 0 24px 70px rgba(15, 23, 42, .18);
  --transition: 180ms ease;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; color: var(--text); background: var(--content); font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-size: 14px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }
svg { display: block; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid rgba(59, 130, 246, .28); outline-offset: 2px; }

.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; top: 8px; left: 8px; z-index: 500; padding: 10px 14px; border-radius: var(--radius-sm); color: #fff; background: var(--primary); transform: translateY(-150%); transition: transform var(--transition); }
.skip-link:focus { color: #fff; transform: translateY(0); }

.app-shell { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 60; display: flex; width: var(--sidebar-width); min-height: 100vh; padding: 0 14px 18px; flex-direction: column; color: #fff; background: linear-gradient(180deg, var(--sidebar) 0%, #182235 100%); transition: width var(--transition), transform var(--transition); }
.sidebar__brand { display: flex; height: var(--topbar-height); padding: 0 6px; align-items: center; justify-content: space-between; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand { display: inline-flex; min-width: 0; align-items: center; gap: 11px; color: #fff; }
.brand:hover { color: #fff; }
.brand__mark { position: relative; display: grid; width: 34px; height: 34px; flex: 0 0 34px; place-items: center; overflow: hidden; border-radius: 10px; background: linear-gradient(135deg, #60a5fa, var(--primary-dark)); box-shadow: 0 8px 20px rgba(37,99,235,.3); }
.brand__mark::before, .brand__mark span { content: ""; position: absolute; border: 2px solid rgba(255,255,255,.95); border-radius: 50%; }
.brand__mark::before { width: 21px; height: 21px; border-right-color: transparent; transform: rotate(-35deg); }
.brand__mark span { width: 11px; height: 11px; border-left-color: transparent; transform: rotate(35deg); }
.brand__mark--large { width: 48px; height: 48px; flex-basis: 48px; border-radius: 14px; }
.brand__mark--large::before { width: 29px; height: 29px; }
.brand__mark--large span { width: 15px; height: 15px; }
.brand__copy { display: flex; align-items: baseline; gap: 5px; white-space: nowrap; }
.brand__copy strong { font-size: 18px; letter-spacing: -.04em; }
.brand__copy small { color: #60a5fa; font-size: 11px; font-weight: 800; letter-spacing: .14em; }
.sidebar__close { display: none; color: var(--sidebar-muted); }
.sidebar__caption { margin: 23px 12px 9px; color: #64748b; font-size: 10px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; white-space: nowrap; }
.sidebar__nav { display: grid; gap: 3px; }
.nav-link { position: relative; display: flex; min-height: 44px; padding: 0 12px; align-items: center; gap: 12px; border-radius: 9px; color: #cbd5e1; font-size: 13px; font-weight: 500; transition: color var(--transition), background var(--transition), transform var(--transition); }
.nav-link svg { width: 19px; height: 19px; flex: 0 0 19px; fill: currentColor; }
.nav-link:hover { color: #fff; background: rgba(255,255,255,.07); transform: translateX(2px); }
.nav-link.is-active { color: #fff; background: var(--primary); box-shadow: 0 8px 22px rgba(59,130,246,.24); }
.nav-link__badge { min-width: 20px; margin-left: auto; padding: 2px 6px; border-radius: 999px; color: #fff; background: var(--danger); font-size: 10px; font-weight: 700; text-align: center; }
.sidebar__footer { display: grid; margin-top: auto; gap: 12px; }
.sidebar__status { display: flex; padding: 12px; align-items: center; gap: 10px; border: 1px solid rgba(255,255,255,.08); border-radius: var(--radius); color: #cbd5e1; background: rgba(15,23,42,.35); }
.sidebar__status > span:last-child { display: grid; min-width: 0; }
.sidebar__status strong { font-size: 11px; font-weight: 600; white-space: nowrap; }
.sidebar__status small { color: #64748b; font-size: 9px; white-space: nowrap; }
.status-light { display: inline-block; width: 8px; height: 8px; flex: 0 0 8px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 4px rgba(34,197,94,.12); }
.sidebar-backdrop { position: fixed; inset: 0; z-index: 50; border: 0; background: rgba(15,23,42,.55); backdrop-filter: blur(2px); }

.workspace { min-height: 100vh; margin-left: var(--sidebar-width); transition: margin-left var(--transition); }
.topbar { position: sticky; top: 0; z-index: 40; display: flex; height: var(--topbar-height); padding: 0 28px; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--border); background: rgba(255,255,255,.94); backdrop-filter: blur(12px); }
.topbar__start, .topbar__actions { display: flex; align-items: center; gap: 14px; }
.mobile-search-toggle { display: none; }
.icon-btn { display: inline-grid; width: 40px; height: 40px; padding: 0; flex: 0 0 40px; place-items: center; border: 1px solid transparent; border-radius: 10px; color: var(--muted); background: transparent; transition: color var(--transition), background var(--transition), border-color var(--transition), transform var(--transition); }
.icon-btn:hover { color: var(--text); border-color: var(--border); background: var(--surface-soft); }
.icon-btn:active { transform: scale(.96); }
.global-search { position: relative; display: flex; width: min(440px, 38vw); align-items: center; }
.global-search > i { position: absolute; left: 14px; color: #94a3b8; pointer-events: none; }
.global-search input { width: 100%; height: 42px; padding: 0 62px 0 40px; border: 1px solid transparent; border-radius: 10px; outline: 0; color: var(--text); background: var(--surface-soft); transition: border-color var(--transition), background var(--transition), box-shadow var(--transition); }
.global-search input::placeholder { color: #94a3b8; }
.global-search input:focus { border-color: #93c5fd; background: #fff; box-shadow: 0 0 0 3px rgba(59,130,246,.12); }
.global-search kbd { position: absolute; right: 10px; padding: 2px 7px; border: 1px solid var(--border); border-radius: 5px; color: #94a3b8; background: #fff; font-family: inherit; font-size: 10px; box-shadow: var(--shadow-sm); }
.dropdown, .profile-menu { position: relative; }
.notification-btn { border-color: var(--border); }
.notification-badge { position: absolute; top: -4px; right: -4px; display: grid; min-width: 18px; height: 18px; padding: 0 4px; place-items: center; border: 2px solid #fff; border-radius: 999px; color: #fff; background: var(--danger); font-size: 9px; font-weight: 700; }
.profile-button { display: flex; padding: 5px 8px 5px 5px; align-items: center; gap: 9px; border: 1px solid transparent; border-radius: 11px; color: var(--text); background: transparent; transition: background var(--transition), border-color var(--transition); }
.profile-button:hover { border-color: var(--border); background: var(--surface-soft); }
.avatar { display: grid; width: 36px; height: 36px; flex: 0 0 36px; place-items: center; border-radius: 10px; color: #1d4ed8; background: #dbeafe; font-size: 11px; font-weight: 800; }
.profile-button__copy { display: grid; min-width: 112px; text-align: left; }
.profile-button__copy strong { overflow: hidden; font-size: 12px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.profile-button__copy small { color: var(--muted); font-size: 10px; text-transform: capitalize; }
.profile-button > i { color: #94a3b8; font-size: 9px; }
.dropdown-panel { position: absolute; top: calc(100% + 10px); right: 0; z-index: 100; min-width: 210px; padding: 8px; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; box-shadow: var(--shadow-lg); animation: dropdown-in 140ms ease; }
.dropdown-panel__head { display: flex; padding: 8px 8px 12px; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); }
.dropdown-panel__head strong { font-size: 12px; }
.text-btn { padding: 0; border: 0; color: var(--primary); background: transparent; font-size: 10px; font-weight: 600; }
.notifications-panel { width: min(350px, calc(100vw - 24px)); }
.notification-item { display: flex; padding: 11px 8px; align-items: center; gap: 10px; border-bottom: 1px solid #f1f5f9; }
.notification-item:last-child { border: 0; }
.notification-item__icon { display: grid; width: 34px; height: 34px; flex: 0 0 34px; place-items: center; border-radius: 9px; color: var(--primary); background: var(--primary-soft); font-size: 12px; }
.notification-item__icon.is-danger { color: var(--danger); background: var(--danger-soft); }
.notification-item__icon.is-success { color: var(--success); background: var(--success-soft); }
.notification-item > span:last-child { display: grid; }
.notification-item strong { font-size: 11px; }
.notification-item small { color: var(--muted); font-size: 9px; }
.profile-panel a, .profile-panel button { display: flex; width: 100%; min-height: 38px; padding: 0 10px; align-items: center; gap: 10px; border: 0; border-radius: 7px; color: var(--text); background: transparent; font-size: 12px; text-align: left; }
.profile-panel a:hover, .profile-panel button:hover { color: var(--primary); background: var(--primary-soft); }
.profile-panel i { width: 14px; color: var(--muted); }

.content { padding: 30px 32px 48px; }
.page-heading { display: flex; margin-bottom: 24px; align-items: flex-end; justify-content: space-between; gap: 20px; }
.breadcrumbs { display: flex; margin-bottom: 8px; align-items: center; gap: 7px; color: #94a3b8; font-size: 10px; }
.breadcrumbs i { font-size: 7px; }
.breadcrumbs strong { color: var(--muted); font-weight: 600; }
.page-heading h1 { margin: 0; font-size: clamp(24px, 2.3vw, 32px); line-height: 1.2; letter-spacing: -.035em; }
.page-heading p { margin: 7px 0 0; color: var(--muted); }
.page-heading__actions { display: flex; align-items: center; gap: 8px; }
.page-content { min-height: 480px; }

.dashboard-grid { display: grid; gap: 18px; }
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.grid { display: grid; gap: 18px; }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid--wide { grid-template-columns: minmax(0, 1.6fr) minmax(280px, .8fr); }
.card, .panel { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
.card { padding: 20px; }
.panel { min-width: 0; overflow: hidden; }
.panel__header { display: flex; min-height: 62px; padding: 14px 18px; align-items: center; justify-content: space-between; gap: 14px; border-bottom: 1px solid var(--border); }
.panel__header h2 { margin: 0; font-size: 14px; letter-spacing: -.01em; }
.panel__header p { margin: 3px 0 0; color: var(--muted); font-size: 10px; }
.panel__body { padding: 18px; }
.panel__body--flush { padding: 0; }
.stat-card { position: relative; display: flex; min-height: 134px; padding: 20px; overflow: hidden; align-items: flex-start; justify-content: space-between; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition); }
.stat-card:hover { border-color: #bfdbfe; box-shadow: var(--shadow); transform: translateY(-2px); }
.stat-card__copy { display: grid; gap: 5px; }
.stat-card__label { color: var(--muted); font-size: 11px; font-weight: 500; }
.stat-card__value { font-size: 29px; font-weight: 750; letter-spacing: -.05em; }
.stat-card__meta { display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: 9px; }
.stat-card__meta.is-up { color: var(--success); }
.stat-card__meta.is-down { color: var(--danger); }
.stat-card__icon { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 11px; color: var(--primary); background: var(--primary-soft); font-size: 16px; }
.stat-card__icon.is-success { color: var(--success); background: var(--success-soft); }
.stat-card__icon.is-warning { color: var(--warning); background: var(--warning-soft); }
.stat-card__icon.is-danger { color: var(--danger); background: var(--danger-soft); }
.metric-list { display: grid; gap: 13px; }
.metric-row { display: grid; grid-template-columns: minmax(100px, 1fr) 2fr auto; align-items: center; gap: 12px; }
.metric-row__label { overflow: hidden; font-size: 10px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.progress { height: 7px; overflow: hidden; border-radius: 999px; background: #e2e8f0; }
.progress__bar { height: 100%; border-radius: inherit; background: var(--primary); transition: width 350ms ease; }
.progress__bar.is-success { background: var(--success); }
.progress__bar.is-warning { background: var(--warning); }
.progress__bar.is-danger { background: var(--danger); }
.metric-row__value { color: var(--muted); font-size: 10px; font-variant-numeric: tabular-nums; }
.activity-list { display: grid; }
.activity-item { display: flex; padding: 12px 0; align-items: flex-start; gap: 11px; border-bottom: 1px solid var(--border); }
.activity-item:first-child { padding-top: 0; }
.activity-item:last-child { padding-bottom: 0; border: 0; }
.activity-item__dot { display: grid; width: 30px; height: 30px; flex: 0 0 30px; place-items: center; border-radius: 9px; color: var(--primary); background: var(--primary-soft); font-size: 10px; }
.activity-item__dot.is-danger { color: var(--danger); background: var(--danger-soft); }
.activity-item__copy { display: grid; min-width: 0; }
.activity-item__copy strong { overflow: hidden; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.activity-item__copy small { color: var(--muted); font-size: 9px; }

@keyframes dropdown-in { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: translateY(0); } }

/* Tables */
.table-wrap { width: 100%; overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; border-spacing: 0; }
.data-table th, .data-table td { padding: 13px 16px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; white-space: nowrap; }
.data-table th { color: var(--muted); background: #f8fafc; font-size: 9px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; }
.data-table td { color: #334155; font-size: 11px; }
.data-table tbody tr { transition: background var(--transition); }
.data-table tbody tr:hover { background: #f8fafc; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.table-primary { display: grid; gap: 2px; }
.table-primary strong { color: var(--text); font-size: 11px; }
.table-primary small { color: var(--muted); font-size: 9px; }
.table-actions { display: flex; justify-content: flex-end; gap: 4px; }
.table-actions .icon-btn { width: 32px; height: 32px; flex-basis: 32px; font-size: 11px; }
.empty-state { display: grid; min-height: 230px; padding: 32px; place-items: center; align-content: center; gap: 8px; color: var(--muted); text-align: center; }
.empty-state i { display: grid; width: 46px; height: 46px; place-items: center; border-radius: 13px; color: #94a3b8; background: var(--surface-soft); font-size: 17px; }
.empty-state strong { color: #475569; font-size: 12px; }
.empty-state p { max-width: 360px; margin: 0; font-size: 10px; }

/* Buttons and badges */
.btn { display: inline-flex; min-height: 40px; padding: 0 16px; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--border); border-radius: 9px; color: #334155; background: #fff; font-size: 11px; font-weight: 650; transition: color var(--transition), background var(--transition), border-color var(--transition), box-shadow var(--transition), transform var(--transition); }
.btn:hover { color: var(--text); border-color: #cbd5e1; background: #f8fafc; }
.btn:active { transform: translateY(1px); }
.btn:disabled { cursor: not-allowed; opacity: .55; }
.btn-primary { color: #fff; border-color: var(--primary); background: var(--primary); box-shadow: 0 5px 14px rgba(59,130,246,.18); }
.btn-primary:hover { color: #fff; border-color: var(--primary-dark); background: var(--primary-dark); }
.btn-danger { color: #fff; border-color: var(--danger); background: var(--danger); }
.btn-danger:hover { color: #fff; border-color: #b91c1c; background: #b91c1c; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-sm { min-height: 32px; padding: 0 11px; font-size: 10px; }
.btn-block { width: 100%; }
.badge { display: inline-flex; min-height: 22px; padding: 3px 8px; align-items: center; justify-content: center; border-radius: 999px; color: #475569; background: #e2e8f0; font-size: 9px; font-weight: 650; line-height: 1; text-transform: none; }
.badge-success { color: #15803d; background: var(--success-soft); }
.badge-warning { color: #a16207; background: var(--warning-soft); }
.badge-danger { color: #b91c1c; background: var(--danger-soft); }
.badge-info { color: #0369a1; background: #e0f2fe; }
.badge-primary { color: #1d4ed8; background: #dbeafe; }

/* Forms */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-group { display: grid; gap: 7px; }
.form-group--full { grid-column: 1 / -1; }
.form-group label, .form-group > span, .label-row label { color: #334155; font-size: 10px; font-weight: 650; }
.label-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.label-row a { font-size: 10px; font-weight: 550; }
input, select, textarea { width: 100%; border: 1px solid #cbd5e1; border-radius: 9px; outline: 0; color: var(--text); background: #fff; transition: border-color var(--transition), box-shadow var(--transition), background var(--transition); }
input, select { height: 42px; padding: 0 12px; }
textarea { min-height: 110px; padding: 11px 12px; resize: vertical; }
input::placeholder, textarea::placeholder { color: #94a3b8; }
input:hover, select:hover, textarea:hover { border-color: #94a3b8; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59,130,246,.12); }
input[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--danger); }
.input-icon { position: relative; }
.input-icon > i:first-child { position: absolute; top: 50%; left: 13px; z-index: 1; color: #94a3b8; transform: translateY(-50%); pointer-events: none; }
.input-icon > input { padding-left: 39px; }
.input-password > input { padding-right: 44px; }
.password-toggle { position: absolute; top: 50%; right: 5px; display: grid; width: 34px; height: 34px; padding: 0; place-items: center; border: 0; border-radius: 7px; color: #94a3b8; background: transparent; transform: translateY(-50%); }
.password-toggle:hover { color: var(--text); background: var(--surface-soft); }
.checkbox-row { display: inline-flex; width: fit-content; align-items: center; gap: 8px; color: var(--muted); font-size: 10px; cursor: pointer; }
.checkbox-row input { width: 15px; height: 15px; accent-color: var(--primary); }
.field-error { min-height: 14px; color: var(--danger); font-size: 9px; }
.filter-bar { display: flex; padding: 14px 16px; align-items: center; gap: 10px; border-bottom: 1px solid var(--border); background: #fff; }
.filter-bar input, .filter-bar select { width: auto; min-width: 150px; height: 36px; font-size: 10px; }
.filter-bar input { flex: 1; }

/* Modal, alerts, tooltips and toasts */
.modal { position: fixed; inset: 0; z-index: 300; display: grid; padding: 20px; place-items: center; }
.modal__backdrop { position: absolute; inset: 0; width: 100%; border: 0; background: rgba(15,23,42,.58); backdrop-filter: blur(3px); }
.modal__dialog { position: relative; z-index: 1; width: min(560px, 100%); max-height: calc(100vh - 40px); overflow: auto; border: 1px solid rgba(255,255,255,.45); border-radius: var(--radius-lg); background: #fff; box-shadow: var(--shadow-lg); animation: modal-in 180ms ease; }
.modal__header, .modal__footer { display: flex; min-height: 64px; padding: 13px 20px; align-items: center; justify-content: space-between; gap: 12px; }
.modal__header { border-bottom: 1px solid var(--border); }
.modal__header h2 { margin: 0; font-size: 16px; }
.modal__body { padding: 20px; }
.modal__footer { justify-content: flex-end; border-top: 1px solid var(--border); background: #f8fafc; }
.alert { padding: 11px 13px; border: 1px solid; border-radius: 9px; font-size: 10px; }
.alert-danger { color: #991b1b; border-color: #fecaca; background: #fef2f2; }
.alert-success { color: #166534; border-color: #bbf7d0; background: #f0fdf4; }
.toast-container { position: fixed; right: 22px; bottom: 22px; z-index: 400; display: grid; width: min(360px, calc(100vw - 30px)); gap: 9px; pointer-events: none; }
.toast { display: grid; grid-template-columns: 34px 1fr auto; padding: 12px; align-items: center; gap: 10px; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; box-shadow: var(--shadow-lg); pointer-events: auto; animation: toast-in 220ms ease; }
.toast__icon { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 9px; color: var(--primary); background: var(--primary-soft); }
.toast.is-success .toast__icon { color: var(--success); background: var(--success-soft); }
.toast.is-danger .toast__icon { color: var(--danger); background: var(--danger-soft); }
.toast.is-warning .toast__icon { color: var(--warning); background: var(--warning-soft); }
.toast__copy { display: grid; }
.toast__copy strong { font-size: 10px; }
.toast__copy small { color: var(--muted); font-size: 9px; }
.toast__close { width: 26px; height: 26px; padding: 0; border: 0; border-radius: 6px; color: #94a3b8; background: transparent; }
.toast.is-leaving { opacity: 0; transform: translateX(24px); transition: 180ms ease; }
[data-tooltip] { position: relative; }
[data-tooltip]::after { position: absolute; right: 50%; bottom: -34px; z-index: 120; padding: 5px 8px; border-radius: 6px; color: #fff; background: #0f172a; content: attr(data-tooltip); font-size: 9px; font-weight: 500; white-space: nowrap; opacity: 0; pointer-events: none; transform: translateX(50%) translateY(-3px); transition: opacity var(--transition), transform var(--transition); }
[data-tooltip]:hover::after, [data-tooltip]:focus-visible::after { opacity: 1; transform: translateX(50%) translateY(0); }

.loading-state, .page-error { display: grid; min-height: 420px; place-items: center; align-content: center; gap: 10px; color: var(--muted); text-align: center; }
.loading-state p, .page-error p { margin: 0; font-size: 11px; }
.spinner { width: 28px; height: 28px; border: 3px solid #dbeafe; border-top-color: var(--primary); border-radius: 50%; animation: spin .7s linear infinite; }
.page-error i { display: grid; width: 52px; height: 52px; place-items: center; border-radius: 15px; color: var(--danger); background: var(--danger-soft); font-size: 18px; }
.page-error h2 { margin: 2px 0 0; font-size: 16px; }
.skeleton { overflow: hidden; border-radius: 7px; background: linear-gradient(90deg, #f1f5f9 20%, #e2e8f0 40%, #f1f5f9 60%); background-size: 200% 100%; animation: shimmer 1.2s infinite; }

/* Monitoring and settings */
.monitor-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.monitor-card { display: grid; padding: 17px; gap: 13px; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; }
.monitor-card__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.monitor-card__head strong { overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.monitor-card__metrics { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.monitor-card__metrics span { display: grid; padding: 9px; border-radius: 8px; color: var(--muted); background: var(--surface-soft); font-size: 8px; }
.monitor-card__metrics b { color: var(--text); font-size: 13px; }
.settings-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); overflow: hidden; }
.settings-nav { display: grid; padding: 12px; align-content: start; gap: 3px; border-right: 1px solid var(--border); background: #f8fafc; }
.settings-nav button { display: flex; min-height: 39px; padding: 0 10px; align-items: center; gap: 9px; border: 0; border-radius: 8px; color: var(--muted); background: transparent; font-size: 10px; text-align: left; }
.settings-nav button.is-active { color: var(--primary-dark); background: #dbeafe; font-weight: 650; }
.settings-content { padding: 22px; }
.settings-content > h2 { margin: 0; font-size: 16px; }
.settings-content > p { margin: 6px 0 20px; color: var(--muted); font-size: 10px; }
.service-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.service-card { padding: 15px; border: 1px solid var(--border); border-left: 3px solid var(--warning); border-radius: 10px; background: #fff; }
.service-card.is-ready { border-left-color: var(--success); }
.service-card__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.service-card__head strong { font-size: 12px; }
.service-card > p { margin: 9px 0 0; color: var(--muted); font-size: 10px; line-height: 1.55; }
.service-card .service-card__missing { color: var(--danger); overflow-wrap: anywhere; }
.service-card__steps { margin: 12px 0 0; padding-left: 19px; color: var(--text); font-size: 10px; line-height: 1.65; }
.settings-note { margin-top: 16px !important; padding: 11px 13px; border-radius: 8px; background: #eff6ff; color: var(--primary-dark) !important; line-height: 1.55; }
.details-list { display: grid; margin: 0; }
.details-row { display: grid; grid-template-columns: minmax(120px, .7fr) minmax(0, 1.3fr); padding: 9px 0; gap: 14px; border-bottom: 1px solid var(--border); }
.details-row:last-child { border: 0; }
.details-row dt { color: var(--muted); font-size: 10px; }
.details-row dd { margin: 0; overflow-wrap: anywhere; color: var(--text); font-size: 10px; font-weight: 550; }

/* Standalone main dashboard */
.dashboard-updated { color: var(--muted); font-size: 10px; white-space: nowrap; }
.dashboard-overview-grid { display: grid; grid-template-columns: minmax(300px, .82fr) minmax(0, 1.6fr); gap: 18px; }
.dashboard-detail-grid { display: grid; grid-template-columns: minmax(440px, 1.35fr) repeat(2, minmax(250px, .82fr)); gap: 18px; align-items: start; }
.dashboard-shell .panel { height: 100%; }
.dashboard-shell .stat-card { isolation: isolate; }
.dashboard-shell .stat-card::after { position: absolute; inset: auto 0 0; height: 2px; content: ""; background: transparent; transition: background var(--transition); }
.dashboard-shell .stat-card.is-success::after { background: var(--success); }
.dashboard-shell .stat-card.is-warning::after { background: var(--warning); }
.dashboard-shell .stat-card.is-danger::after { background: var(--danger); }
.stat-card__value.is-success { color: var(--success); }
.stat-card__value.is-warning { color: var(--warning); }
.stat-card__value.is-danger { color: var(--danger); }
.sidebar__status.is-warning .status-light { background: #f59e0b; box-shadow: 0 0 0 4px rgba(245,158,11,.14); }
.sidebar__status.is-danger .status-light { background: #ef4444; box-shadow: 0 0 0 4px rgba(239,68,68,.14); }

.alert-list { display: grid; max-height: 355px; overflow: auto; align-content: start; gap: 9px; }
.alert-entry { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; min-height: 61px; padding: 10px; align-items: center; gap: 10px; border: 1px solid var(--border); border-radius: 10px; background: #fff; }
.alert-entry.is-danger { border-color: #fecaca; background: #fffafa; }
.alert-entry.is-warning { border-color: #fde68a; background: #fffdf7; }
.alert-entry__icon { display: grid; width: 36px; height: 36px; place-items: center; border-radius: 9px; color: var(--danger); background: var(--danger-soft); font-size: 12px; }
.alert-entry.is-warning .alert-entry__icon { color: var(--warning); background: var(--warning-soft); }
.alert-entry__copy { display: grid; min-width: 0; }
.alert-entry__copy strong { overflow: hidden; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.alert-entry__copy small { overflow: hidden; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.alert-entry--skeleton { grid-template-columns: 36px minmax(0, 1fr); }
.alert-entry--skeleton > span:last-child { display: grid; gap: 8px; }

.traffic-panel { min-height: 355px; }
.traffic-total { color: var(--primary); font-size: 12px; font-weight: 700; white-space: nowrap; }
.chart-wrap { position: relative; height: 292px; }
.chart-wrap canvas { width: 100% !important; height: 100% !important; }
.chart-skeleton { position: absolute; inset: 18px; z-index: 1; }
.skeleton--chart { display: block; width: 100%; height: 100%; border-radius: 10px; }
.chart-fallback { display: grid; height: 100%; margin: 0; place-items: center; color: var(--muted); font-size: 10px; }

.dashboard-table th:first-child, .dashboard-table td:first-child { width: 48px; padding-right: 0; text-align: center; }
.dashboard-table td:nth-child(2) { width: 48%; max-width: 290px; }
.dashboard-table .table-primary strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-check { position: relative; display: inline-grid; width: 20px; height: 20px; place-items: center; cursor: pointer; }
.task-check input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.task-check span { display: grid; width: 18px; height: 18px; place-items: center; border: 1.5px solid #cbd5e1; border-radius: 6px; background: #fff; transition: border-color var(--transition), background var(--transition), box-shadow var(--transition); }
.task-check input:focus-visible + span { outline: 3px solid rgba(59,130,246,.22); outline-offset: 2px; }
.task-check input:checked + span { border-color: var(--success); background: var(--success); }
.task-check input:checked + span::after { width: 7px; height: 4px; border-bottom: 2px solid #fff; border-left: 2px solid #fff; content: ""; transform: translateY(-1px) rotate(-45deg); }
.task-check input:disabled + span { cursor: wait; opacity: .6; }
.task-deadline { font-variant-numeric: tabular-nums; }
.task-deadline.is-overdue { color: var(--danger); font-weight: 650; }
.task-row.is-updating { opacity: .55; }
.task-row.is-completed td { color: #94a3b8; text-decoration: line-through; background: #f8fafc; }

.ticket-list { display: grid; padding-top: 8px; padding-bottom: 8px; }
.ticket-entry { display: flex; min-width: 0; min-height: 59px; padding: 10px 0; align-items: center; justify-content: space-between; gap: 10px; border-bottom: 1px solid var(--border); color: inherit; }
.ticket-entry:last-child { border-bottom: 0; }
.ticket-entry:hover { color: inherit; }
.ticket-entry:hover strong { color: var(--primary); }
.ticket-entry__copy { display: grid; min-width: 0; }
.ticket-entry__copy strong { overflow: hidden; color: var(--text); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; transition: color var(--transition); }
.ticket-entry__copy small { overflow: hidden; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.ticket-entry .badge { flex: 0 0 auto; }
.ticket-entry--skeleton > span { display: grid; width: 68%; gap: 8px; }
.activity-item__dot.is-success { color: var(--success); background: var(--success-soft); }
.dashboard-detail-grid .activity-list { max-height: 448px; overflow: auto; }
.dashboard-detail-grid .activity-item__copy { flex: 1; }

.compact-empty { display: grid; min-height: 142px; padding: 22px 14px; place-items: center; align-content: center; gap: 6px; color: var(--muted); text-align: center; }
.compact-empty > i { display: grid; width: 38px; height: 38px; margin-bottom: 2px; place-items: center; border-radius: 10px; color: var(--success); background: var(--success-soft); font-size: 13px; }
.compact-empty strong { color: #475569; font-size: 10px; }
.compact-empty small { font-size: 9px; }
.dashboard-table .compact-empty { min-height: 190px; }

.skeleton--kpi { display: inline-block; width: 86px; height: 31px; }
.skeleton--line { display: block; width: 86px; height: 9px; font-style: normal; }
.skeleton--line.skeleton--wide { width: min(170px, 90%); }
.skeleton--avatar { display: block; width: 34px; height: 34px; flex: 0 0 34px; border-radius: 9px; }
.skeleton--badge { display: block; width: 58px; height: 22px; border-radius: 999px; }
.skeleton--check { display: inline-block; width: 18px; height: 18px; border-radius: 6px; }
.skeleton-row td { height: 59px; }
.dashboard-shell .activity-item .skeleton--line + .skeleton--line { margin-top: 8px; }
.btn.is-loading i { animation: spin .7s linear infinite; }

@media (max-width: 1280px) {
  .dashboard-detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .upcoming-tasks-panel { grid-column: 1 / -1; }
}

@media (max-width: 1050px) {
  .dashboard-overview-grid { grid-template-columns: 1fr; }
  .alert-list { max-height: none; }
}

@media (max-width: 760px) {
  .dashboard-detail-grid { grid-template-columns: 1fr; }
  .upcoming-tasks-panel { grid-column: auto; }
  .dashboard-updated { display: none; }
  .chart-wrap { height: 250px; }
}

@media (max-width: 520px) {
  .alert-entry { grid-template-columns: 36px minmax(0, 1fr); }
  .alert-entry .btn { grid-column: 2; justify-self: start; }
  .traffic-total { display: none; }
  .dashboard-table th:nth-child(3), .dashboard-table td:nth-child(3) { display: none; }
  .dashboard-table td:nth-child(2) { max-width: 210px; }
}

/* CRM clients and projects */
.topbar-context { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; font-weight: 600; }
.topbar-context i { color: var(--primary); }
.crm-list-panel { overflow: visible; }
.crm-toolbar { display: grid; grid-template-columns: minmax(260px, 1fr) minmax(150px, .32fr) minmax(150px, .32fr) auto; padding: 14px 16px; align-items: center; gap: 10px; border-bottom: 1px solid var(--border); border-radius: var(--radius) var(--radius) 0 0; background: #fff; }
.crm-toolbar--projects { grid-template-columns: repeat(3, minmax(150px, .5fr)) minmax(150px, .6fr) auto; }
.crm-toolbar input, .crm-toolbar select { height: 38px; font-size: 10px; }
.crm-search { position: relative; display: block; }
.crm-search i { position: absolute; top: 50%; left: 13px; z-index: 1; color: #94a3b8; font-size: 10px; transform: translateY(-50%); pointer-events: none; }
.crm-search input { padding-left: 36px; }
.crm-archive-filter { min-height: 38px; padding: 0 10px; border: 1px solid var(--border); border-radius: 9px; background: #f8fafc; white-space: nowrap; }
.crm-table { min-width: 960px; }
.crm-table tbody tr.crm-clickable-row { cursor: pointer; }
.crm-table tbody tr.crm-clickable-row:focus-visible { outline: 3px solid rgba(59,130,246,.22); outline-offset: -3px; }
.crm-table tbody tr.crm-clickable-row.is-archived { opacity: .58; }
.crm-table .table-primary strong { max-width: 260px; }
.tag-list { display: flex; max-width: 230px; flex-wrap: wrap; gap: 4px; }
.crm-balance, .crm-money, .crm-count { font-weight: 650; font-variant-numeric: tabular-nums; }
.crm-balance.is-negative, .is-negative { color: var(--danger); }
.crm-balance.is-positive, .is-positive { color: var(--success); }
.crm-pagination { display: flex; min-height: 61px; padding: 12px 16px; align-items: center; justify-content: space-between; gap: 16px; border-top: 1px solid var(--border); color: var(--muted); background: #fff; font-size: 10px; }
.crm-pagination > div { display: flex; align-items: center; gap: 10px; }
.crm-pagination > div > span { min-width: 24px; color: var(--text); font-weight: 700; text-align: center; }

body.modal-open { overflow: hidden; }
.modal--wide .modal__dialog { width: min(1040px, 100%); }
.modal-kicker { margin: 0 0 2px; color: var(--primary); font-size: 8px; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; }
.modal__header > div h2 { margin: 0; }
.modal-tabs { display: flex; padding: 0 18px; overflow-x: auto; border-bottom: 1px solid var(--border); background: #f8fafc; }
.modal-tabs button { position: relative; min-height: 49px; padding: 0 13px; border: 0; color: var(--muted); background: transparent; font-size: 10px; font-weight: 600; white-space: nowrap; }
.modal-tabs button::after { position: absolute; right: 10px; bottom: -1px; left: 10px; height: 2px; border-radius: 2px 2px 0 0; content: ""; background: transparent; }
.modal-tabs button.is-active { color: var(--primary); }
.modal-tabs button.is-active::after { background: var(--primary); }
.modal-tabs button span { display: inline-grid; min-width: 18px; height: 18px; margin-left: 4px; place-items: center; border-radius: 999px; color: #475569; background: #e2e8f0; font-size: 8px; }
.crm-modal-body { min-height: min(530px, 62vh); }
.crm-modal-body > section { animation: modal-tab-in 160ms ease; }
.form-actions { display: flex; padding-top: 4px; justify-content: flex-end; }
.tab-panel-head { display: flex; margin-bottom: 15px; align-items: center; justify-content: space-between; gap: 16px; }
.tab-panel-head h3 { margin: 0; font-size: 14px; }
.tab-panel-head p { margin: 4px 0 0; color: var(--muted); font-size: 9px; }
.entity-list { display: grid; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.entity-item { display: flex; min-height: 61px; padding: 11px 13px; align-items: center; justify-content: space-between; gap: 14px; border-bottom: 1px solid var(--border); color: inherit; background: #fff; transition: background var(--transition); }
.entity-item:last-child { border-bottom: 0; }
a.entity-item:hover { color: inherit; background: #f8fafc; }
.entity-item__copy { display: grid; min-width: 0; }
.entity-item__copy strong { overflow: hidden; color: var(--text); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.entity-item__copy small { overflow: hidden; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.entity-item .badge { flex: 0 0 auto; }
.client-finance-card { display: grid; min-height: 220px; padding: 28px; place-items: center; align-content: center; gap: 7px; border: 1px solid var(--border); border-radius: 14px; background: linear-gradient(145deg, #fff, #f8fafc); text-align: center; }
.client-finance-card span { color: var(--muted); font-size: 10px; }
.client-finance-card strong { font-size: clamp(30px, 5vw, 48px); letter-spacing: -.05em; }
.client-finance-card small { max-width: 390px; color: var(--muted); font-size: 9px; }
.project-summary-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.summary-mini-card { display: flex; min-height: 102px; padding: 18px; align-items: center; gap: 12px; border: 1px solid var(--border); border-radius: 11px; background: #fff; }
.summary-mini-card__icon { display: grid; width: 40px; height: 40px; flex: 0 0 40px; place-items: center; border-radius: 10px; color: var(--primary); background: var(--primary-soft); }
.summary-mini-card__icon.is-success { color: var(--success); background: var(--success-soft); }
.summary-mini-card__icon.is-warning { color: var(--warning); background: var(--warning-soft); }
.summary-mini-card__icon.is-info { color: var(--info); background: #e0f2fe; }
.summary-mini-card > span:last-child { display: grid; }
.summary-mini-card small { color: var(--muted); font-size: 9px; }
.summary-mini-card strong { font-size: 17px; }
@keyframes modal-tab-in { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 1100px) {
  .crm-toolbar { grid-template-columns: minmax(240px, 1fr) repeat(2, minmax(145px, .5fr)); }
  .crm-toolbar .btn { grid-column: 3; justify-self: end; }
  .crm-toolbar--projects { grid-template-columns: repeat(3, minmax(145px, 1fr)); }
  .crm-toolbar--projects .crm-archive-filter { grid-column: 1 / 3; }
}

@media (max-width: 760px) {
  .topbar-context { display: none; }
  .crm-toolbar, .crm-toolbar--projects { grid-template-columns: 1fr 1fr; }
  .crm-search { grid-column: 1 / -1; }
  .crm-toolbar .btn, .crm-toolbar--projects .btn { grid-column: auto; justify-self: stretch; }
  .crm-toolbar--projects .crm-archive-filter { grid-column: auto; }
  .crm-pagination { align-items: flex-start; flex-direction: column; }
  .modal--wide .modal__dialog { max-height: calc(100vh - 20px); }
  .modal-tabs { padding: 0 8px; }
  .crm-modal-body { min-height: 480px; }
}

@media (max-width: 520px) {
  .crm-toolbar, .crm-toolbar--projects { grid-template-columns: 1fr; }
  .crm-search, .crm-toolbar--projects .crm-archive-filter { grid-column: auto; }
  .project-summary-grid { grid-template-columns: 1fr; }
  .entity-item { align-items: flex-start; flex-direction: column; }
  .entity-item .badge { align-self: flex-start; }
  .modal__footer { align-items: stretch; flex-direction: column-reverse; }
  .modal__footer .btn { width: 100%; }
}

/* Tasks kanban */
.kanban-content { max-width: 1780px; margin: 0 auto; }
.kanban-total { display: inline-flex; min-height: 34px; padding: 0 11px; align-items: center; border: 1px solid var(--border); border-radius: 9px; color: var(--muted); background: #fff; font-size: 10px; font-weight: 650; }
.kanban-toolbar { display: flex; margin-bottom: 18px; padding: 13px 15px; align-items: flex-end; gap: 10px; overflow: visible; }
.kanban-toolbar label { display: grid; min-width: 210px; gap: 5px; }
.kanban-toolbar label > span { color: var(--muted); font-size: 9px; font-weight: 650; }
.kanban-toolbar select { height: 38px; font-size: 10px; }
.kanban-hint { display: inline-flex; margin-left: auto; min-height: 38px; align-items: center; gap: 7px; color: #94a3b8; font-size: 9px; white-space: nowrap; }
.kanban-hint i { color: var(--primary); }

.kanban-board { display: grid; grid-template-columns: repeat(4, minmax(270px, 1fr)); align-items: start; gap: 14px; overflow-x: auto; overscroll-behavior-x: contain; padding: 1px 1px 15px; scrollbar-width: thin; scroll-snap-type: x proximity; }
.kanban-column { display: grid; min-width: 0; max-height: calc(100vh - 235px); padding: 10px; grid-template-rows: auto minmax(160px, 1fr) auto; gap: 8px; border: 1px solid var(--border); border-radius: 14px; background: #f1f5f9; scroll-snap-align: start; transition: border-color var(--transition), background var(--transition), box-shadow var(--transition); }
.kanban-column.is-drop-target { border-color: #93c5fd; background: #eff6ff; box-shadow: inset 0 0 0 1px rgba(59,130,246,.12), 0 10px 30px rgba(59,130,246,.08); }
.kanban-column__header { display: flex; min-height: 42px; padding: 3px 5px 7px; align-items: center; gap: 8px; }
.kanban-column__header h2 { margin: 0; font-size: 11px; font-weight: 700; }
.kanban-status-dot { width: 8px; height: 8px; flex: 0 0 8px; border-radius: 50%; background: #94a3b8; box-shadow: 0 0 0 4px rgba(148,163,184,.12); }
.kanban-status-dot.is-todo { background: #64748b; }
.kanban-status-dot.is-progress { background: var(--primary); box-shadow: 0 0 0 4px rgba(59,130,246,.12); }
.kanban-status-dot.is-hold { background: var(--warning); box-shadow: 0 0 0 4px rgba(217,119,6,.12); }
.kanban-status-dot.is-done { background: var(--success); box-shadow: 0 0 0 4px rgba(22,163,74,.12); }
.kanban-column__count { display: grid; min-width: 23px; height: 23px; margin-left: auto; padding: 0 6px; place-items: center; border-radius: 999px; color: #475569; background: #e2e8f0; font-size: 9px; font-weight: 700; }
.kanban-dropzone { display: grid; min-height: 165px; padding: 2px; align-content: start; gap: 9px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.kanban-add { display: flex; min-height: 38px; padding: 0 10px; align-items: center; justify-content: center; gap: 7px; border: 1px dashed #cbd5e1; border-radius: 9px; color: var(--muted); background: rgba(255,255,255,.55); font-size: 10px; font-weight: 600; transition: color var(--transition), border-color var(--transition), background var(--transition); }
.kanban-add:hover { color: var(--primary); border-color: #93c5fd; background: #fff; }

.kanban-card { position: relative; display: grid; min-width: 0; padding: 13px; gap: 10px; border: 1px solid var(--border); border-left: 3px solid #94a3b8; border-radius: 11px; background: #fff; box-shadow: 0 2px 5px rgba(15,23,42,.04); cursor: pointer; user-select: none; transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition), opacity var(--transition); will-change: transform; }
.kanban-card:hover { border-color: #bfdbfe; box-shadow: 0 10px 22px rgba(15,23,42,.09); transform: translateY(-2px); }
.kanban-card.priority-danger { border-left-color: var(--danger); }
.kanban-card.priority-warning { border-left-color: #f59e0b; }
.kanban-card.priority-success { border-left-color: var(--success); }
.kanban-card__head { display: flex; min-height: 22px; align-items: center; justify-content: space-between; gap: 8px; }
.task-drag-handle { display: grid; width: 26px; height: 26px; padding: 0; place-items: center; border: 0; border-radius: 7px; color: #94a3b8; background: transparent; cursor: grab; touch-action: none; }
.task-drag-handle:hover { color: var(--primary); background: var(--primary-soft); }
.task-drag-handle:active { cursor: grabbing; }
.task-priority { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 8px; font-weight: 650; }
.task-priority i { width: 6px; height: 6px; border-radius: 50%; background: #94a3b8; }
.task-priority.is-danger i { background: var(--danger); box-shadow: 0 0 0 3px rgba(220,38,38,.1); }
.task-priority.is-warning i { background: #f59e0b; box-shadow: 0 0 0 3px rgba(245,158,11,.1); }
.task-priority.is-success i { background: var(--success); box-shadow: 0 0 0 3px rgba(22,163,74,.1); }
.kanban-card h3 { display: -webkit-box; margin: 0; overflow: hidden; font-size: 11px; line-height: 1.45; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.kanban-column[data-status="done"] .kanban-card h3 { color: #64748b; text-decoration: line-through; text-decoration-color: #cbd5e1; }
.task-project-badge { width: fit-content; max-width: 100%; padding: 4px 7px; overflow: hidden; border-radius: 6px; color: #1d4ed8; background: #eff6ff; font-size: 8px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.kanban-card__meta { display: flex; align-items: center; justify-content: space-between; }
.task-due { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 8px; }
.task-due i { color: #94a3b8; }
.task-due.is-overdue { color: var(--danger); font-weight: 700; }
.task-due.is-overdue i { color: var(--danger); }
.kanban-card__footer { display: flex; padding-top: 9px; align-items: center; justify-content: space-between; border-top: 1px solid #f1f5f9; }
.task-timer-button { display: inline-flex; min-height: 30px; padding: 0 9px; align-items: center; gap: 6px; border: 1px solid var(--border); border-radius: 8px; color: #475569; background: #fff; font-size: 8px; font-weight: 650; transition: color var(--transition), border-color var(--transition), background var(--transition); }
.task-timer-button:hover { color: var(--primary); border-color: #93c5fd; background: var(--primary-soft); }
.task-timer-button.is-running { color: #fff; border-color: var(--danger); background: var(--danger); animation: timer-pulse 1.8s ease-in-out infinite; }
.task-avatar { display: grid; width: 29px; height: 29px; place-items: center; border: 2px solid #fff; border-radius: 9px; color: #1d4ed8; background: #dbeafe; font-size: 8px; font-weight: 800; box-shadow: 0 0 0 1px var(--border); }
.task-avatar.is-empty { color: #94a3b8; background: #f1f5f9; }
.task-avatar.is-empty i { font-size: 9px; }
.kanban-empty { display: grid; min-height: 102px; padding: 20px 10px; place-items: center; align-content: center; gap: 6px; border: 1px dashed #d6dee8; border-radius: 10px; color: #94a3b8; font-size: 8px; text-align: center; }
.kanban-empty i { color: #cbd5e1; }
.kanban-skeleton { display: grid; gap: 9px; }
.skeleton--task-card { display: block; width: 100%; height: 177px; border-radius: 11px; }

.kanban-card-placeholder { min-height: 150px; border: 2px dashed #60a5fa; border-radius: 11px; background: rgba(219,234,254,.55); animation: placeholder-in 150ms ease; }
.kanban-card--dragging { position: fixed; top: 0; left: 0; z-index: 1000; margin: 0; opacity: .94; pointer-events: none; box-shadow: 0 24px 55px rgba(15,23,42,.24); transition: none; transform-origin: center; }
.kanban-card--dragging:hover { transform: none; }
.is-dragging-task, .is-dragging-task * { cursor: grabbing !important; }
.kanban-card.is-just-dropped { animation: task-drop 250ms ease; }

.task-detail-layout { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(285px, .72fr); gap: 24px; }
.task-detail-main { min-width: 0; }
.task-detail-aside { display: grid; align-content: start; gap: 14px; }
.timer-widget { display: grid; padding: 18px; place-items: center; gap: 8px; border: 1px solid var(--border); border-radius: 13px; background: linear-gradient(145deg, #f8fafc, #fff); text-align: center; }
.timer-widget.is-running { border-color: #fecaca; background: linear-gradient(145deg, #fff7f7, #fff); }
.timer-widget__label { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 9px; font-weight: 650; }
.timer-widget__label i { color: var(--primary); }
.timer-widget.is-running .timer-widget__label i { color: var(--danger); }
.timer-widget strong { font-size: 30px; font-variant-numeric: tabular-nums; letter-spacing: -.04em; }
.timer-widget small { color: var(--muted); font-size: 8px; }
.task-comments { overflow: hidden; border: 1px solid var(--border); border-radius: 13px; background: #fff; }
.task-comments > header { display: flex; min-height: 48px; padding: 10px 13px; align-items: center; border-bottom: 1px solid var(--border); background: #f8fafc; }
.task-comments > header > div { display: flex; align-items: center; gap: 7px; }
.task-comments h3 { margin: 0; font-size: 11px; }
.task-comments header span { display: grid; min-width: 19px; height: 19px; padding: 0 5px; place-items: center; border-radius: 999px; color: #475569; background: #e2e8f0; font-size: 8px; }
.task-comment-list { display: grid; max-height: 252px; padding: 12px; gap: 12px; overflow-y: auto; }
.task-comment-list .kanban-empty { min-height: 90px; }
.task-comment { display: grid; grid-template-columns: 29px minmax(0, 1fr); align-items: start; gap: 8px; }
.task-comment__avatar { display: grid; width: 29px; height: 29px; place-items: center; border-radius: 9px; color: #1d4ed8; background: #dbeafe; font-size: 8px; font-weight: 800; }
.task-comment__content { min-width: 0; padding: 8px 9px; border-radius: 2px 9px 9px; background: #f1f5f9; }
.task-comment__content header { display: flex; margin-bottom: 4px; justify-content: space-between; gap: 8px; }
.task-comment__content strong { font-size: 8px; }
.task-comment__content time { color: #94a3b8; font-size: 7px; }
.task-comment__content p { margin: 0; color: #475569; font-size: 9px; white-space: pre-wrap; overflow-wrap: anywhere; }
.task-comments form { display: grid; padding: 10px; gap: 8px; border-top: 1px solid var(--border); }
.task-comments form textarea { min-height: 72px; font-size: 9px; }
.task-comments form .btn { justify-self: end; }

@keyframes placeholder-in { from { opacity: 0; transform: scale(.97); } to { opacity: 1; transform: scale(1); } }
@keyframes task-drop { 0% { transform: scale(.97); } 60% { transform: scale(1.015); } 100% { transform: scale(1); } }
@keyframes timer-pulse { 50% { box-shadow: 0 0 0 5px rgba(220,38,38,.1); } }

@media (max-width: 1180px) {
  .kanban-board { grid-template-columns: repeat(4, minmax(290px, 1fr)); }
  .kanban-column { max-height: calc(100vh - 250px); }
  .task-detail-layout { grid-template-columns: 1fr; }
  .task-detail-aside { grid-template-columns: minmax(230px, .55fr) minmax(300px, 1fr); }
}

@media (max-width: 760px) {
  .kanban-toolbar { display: grid; grid-template-columns: 1fr 1fr; align-items: end; }
  .kanban-toolbar label { min-width: 0; }
  .kanban-hint { grid-column: 1 / -1; margin: 0; }
  .kanban-board { grid-template-columns: repeat(4, minmax(82vw, 1fr)); margin-right: -14px; padding-right: 14px; }
  .kanban-column { max-height: calc(100vh - 300px); min-height: 460px; }
  .task-detail-aside { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  .kanban-toolbar { grid-template-columns: 1fr; }
  .kanban-hint { grid-column: auto; }
  .kanban-board { grid-template-columns: repeat(4, minmax(88vw, 1fr)); }
  .kanban-total { display: none; }
  .timer-widget strong { font-size: 26px; }
}

/* Monitoring and analytics */
.insights-content { max-width: 1540px; margin: 0 auto; }
.insights-content .page-heading__actions { flex-wrap: wrap; }
.status-light.is-danger { background: var(--danger); box-shadow: 0 0 0 4px rgba(220,38,38,.12); }
.monitor-summary { display: grid; margin-bottom: 22px; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; }
.monitor-summary-card { display: flex; min-height: 92px; padding: 17px; align-items: center; gap: 13px; border: 1px solid var(--border); border-radius: 13px; background: #fff; box-shadow: 0 3px 12px rgba(15,23,42,.035); }
.monitor-summary-card__icon { display: grid; width: 42px; height: 42px; flex: 0 0 42px; place-items: center; border-radius: 11px; font-size: 15px; }
.monitor-summary-card__icon.is-blue { color: #2563eb; background: #eff6ff; }
.monitor-summary-card__icon.is-green { color: #15803d; background: #f0fdf4; }
.monitor-summary-card__icon.is-red { color: #dc2626; background: #fef2f2; }
.monitor-summary-card__icon.is-violet { color: #7c3aed; background: #f5f3ff; }
.monitor-summary-card div { display: grid; gap: 4px; }
.monitor-summary-card small { color: var(--muted); font-size: 9px; font-weight: 600; }
.monitor-summary-card strong { font-size: 20px; font-variant-numeric: tabular-nums; letter-spacing: -.04em; }
.monitoring-section { display: grid; gap: 13px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 18px; }
.section-heading h2 { margin: 0; font-size: 16px; }
.section-heading p { margin: 5px 0 0; color: var(--muted); font-size: 9px; }
.status-legend { display: flex; align-items: center; gap: 13px; color: var(--muted); font-size: 8px; font-weight: 600; }
.status-legend span { display: inline-flex; align-items: center; gap: 5px; }
.status-legend i { width: 7px; height: 7px; border-radius: 50%; }
.status-legend .is-ok { background: #16a34a; box-shadow: 0 0 0 3px rgba(22,163,74,.1); }
.status-legend .is-degraded { background: #f59e0b; box-shadow: 0 0 0 3px rgba(245,158,11,.1); }
.status-legend .is-down { background: #dc2626; box-shadow: 0 0 0 3px rgba(220,38,38,.1); }
.website-status-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.website-status-grid > .insight-empty { grid-column: 1 / -1; min-height: 280px; }
.website-status-card { position: relative; display: grid; min-width: 0; min-height: 250px; padding: 17px; gap: 14px; overflow: hidden; border: 1px solid var(--border); border-top: 3px solid #cbd5e1; border-radius: 14px; background: #fff; box-shadow: 0 4px 15px rgba(15,23,42,.045); cursor: pointer; transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition); }
.website-status-card::after { position: absolute; right: -35px; bottom: -52px; width: 120px; height: 120px; content: ""; border-radius: 50%; opacity: .55; background: #f8fafc; pointer-events: none; }
.website-status-card:hover, .website-status-card:focus-visible { z-index: 1; border-color: #bfdbfe; box-shadow: 0 14px 35px rgba(15,23,42,.1); outline: 0; transform: translateY(-3px); }
.website-status-card.is-ok { border-top-color: #22c55e; }
.website-status-card.is-degraded { border-top-color: #f59e0b; }
.website-status-card.is-down { border-top-color: #ef4444; background: linear-gradient(155deg, #fff 60%, #fff7f7); }
.website-status-card.is-unknown { border-top-color: #94a3b8; }
.website-status-card__head { display: flex; min-width: 0; align-items: flex-start; justify-content: space-between; gap: 10px; }
.website-identity { display: flex; min-width: 0; align-items: center; gap: 10px; }
.website-favicon { display: grid; width: 36px; height: 36px; flex: 0 0 36px; place-items: center; border: 1px solid #dbeafe; border-radius: 10px; color: #1d4ed8; background: #eff6ff; font-size: 11px; font-weight: 800; }
.website-identity > div { min-width: 0; }
.website-identity h2 { margin: 0; overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.website-identity p { margin: 4px 0 0; overflow: hidden; color: var(--muted); font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.website-state, .site-state-badge { display: inline-flex; min-height: 25px; padding: 0 8px; flex: 0 0 auto; align-items: center; gap: 5px; border-radius: 999px; font-size: 8px; font-weight: 700; }
.website-state i { width: 6px; height: 6px; border-radius: 50%; }
.website-state.is-ok, .site-state-badge.is-ok { color: #15803d; background: #dcfce7; }
.website-state.is-ok i { background: #16a34a; }
.website-state.is-degraded, .site-state-badge.is-degraded { color: #a16207; background: #fef3c7; }
.website-state.is-degraded i { background: #f59e0b; }
.website-state.is-down, .site-state-badge.is-down { color: #b91c1c; background: #fee2e2; }
.website-state.is-down i { background: #dc2626; animation: status-pulse 1.8s ease-in-out infinite; }
.website-state.is-unknown, .site-state-badge.is-unknown { color: #64748b; background: #f1f5f9; }
.website-state.is-unknown i { background: #94a3b8; }
.website-status-reason { min-height: 30px; margin: 0; color: #64748b; font-size: 9px; line-height: 1.55; }
.website-status-card.is-down .website-status-reason { color: #b91c1c; }
.website-metrics { display: grid; padding: 13px 0; grid-template-columns: 1fr 1fr; border-top: 1px solid #f1f5f9; border-bottom: 1px solid #f1f5f9; }
.website-metrics > div { display: grid; gap: 4px; }
.website-metrics > div + div { padding-left: 15px; border-left: 1px solid #e2e8f0; }
.website-metrics small { color: var(--muted); font-size: 8px; }
.website-metrics strong { font-size: 14px; font-variant-numeric: tabular-nums; }
.website-metrics strong.is-good { color: #15803d; }
.website-status-card__footer { position: relative; z-index: 1; display: flex; min-width: 0; align-items: end; justify-content: space-between; gap: 10px; }
.website-status-card__footer > div { display: flex; min-width: 0; align-items: center; flex-wrap: wrap; gap: 7px; }
.ssl-badge { display: inline-flex; min-height: 24px; padding: 0 7px; align-items: center; border-radius: 7px; color: #64748b; background: #f1f5f9; font-size: 7px; font-weight: 650; }
.ssl-badge.is-safe { color: #15803d; background: #f0fdf4; }
.ssl-badge.is-warning { color: #a16207; background: #fef3c7; }
.ssl-badge.is-danger { color: #b91c1c; background: #fee2e2; }
.website-last-check { color: #94a3b8; font-size: 7px; }
.website-open-icon { display: grid; width: 29px; height: 29px; flex: 0 0 29px; place-items: center; border-radius: 8px; color: #94a3b8; background: #f8fafc; transition: color var(--transition), transform var(--transition); }
.website-status-card:hover .website-open-icon { color: var(--primary); transform: translateX(2px); }
.website-status-card.is-skeleton { min-height: 250px; cursor: default; }
.website-status-card.is-skeleton .skeleton:nth-child(1) { height: 42px; }
.website-status-card.is-skeleton .skeleton:nth-child(2) { height: 68px; }
.website-status-card.is-skeleton .skeleton:nth-child(3) { height: 40px; }
.website-status-card.is-skeleton:hover { transform: none; }
.modal-subtitle { margin: 5px 0 0; color: var(--muted); font-size: 9px; }
.monitoring-detail { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(280px, .7fr); gap: 18px; }
.monitoring-detail__chart, .monitoring-events { overflow: hidden; border: 1px solid var(--border); border-radius: 13px; background: #fff; }
.monitoring-detail__chart > header, .monitoring-events > header { display: flex; min-height: 58px; padding: 12px 15px; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--border); background: #f8fafc; }
.monitoring-detail h3 { margin: 0; font-size: 11px; }
.monitoring-detail__chart header p { margin: 4px 0 0; color: var(--muted); font-size: 8px; }
.monitoring-events > header span { display: grid; min-width: 22px; height: 22px; padding: 0 5px; place-items: center; border-radius: 999px; color: #475569; background: #e2e8f0; font-size: 8px; font-weight: 700; }
.insight-chart { position: relative; min-height: 320px; }
.insight-chart canvas { width: 100% !important; height: 100% !important; }
.insight-chart--history { height: 350px; padding: 16px; }
.monitoring-event-log { display: grid; max-height: 350px; padding: 13px; align-content: start; gap: 12px; overflow-y: auto; }
.monitoring-event { display: grid; grid-template-columns: 30px minmax(0, 1fr); align-items: start; gap: 9px; }
.monitoring-event__mark { display: grid; width: 30px; height: 30px; place-items: center; border-radius: 9px; font-size: 9px; }
.monitoring-event.is-incident .monitoring-event__mark { color: #dc2626; background: #fee2e2; }
.monitoring-event.is-recovery .monitoring-event__mark { color: #15803d; background: #dcfce7; }
.monitoring-event strong { font-size: 9px; }
.monitoring-event p { margin: 4px 0; color: #64748b; font-size: 8px; line-height: 1.5; }
.monitoring-event time { color: #94a3b8; font-size: 7px; }
.insight-loading { display: grid; min-height: 150px; place-items: center; align-content: center; gap: 9px; color: var(--muted); font-size: 9px; text-align: center; }
.insight-chart > .insight-loading { position: absolute; inset: 0; z-index: 2; background: rgba(255,255,255,.94); }
.insight-empty { display: grid; width: 100%; min-height: 150px; padding: 28px; place-items: center; align-content: center; gap: 7px; color: var(--muted); text-align: center; }
.insight-empty > i { margin-bottom: 4px; color: #cbd5e1; font-size: 24px; }
.insight-empty strong { color: #475569; font-size: 10px; }
.insight-empty p { max-width: 420px; margin: 0; font-size: 8px; line-height: 1.55; }

.analytics-toolbar { display: flex; margin-bottom: 16px; padding: 13px 15px; align-items: end; gap: 16px; }
.analytics-site-select { display: grid; min-width: 250px; gap: 5px; }
.analytics-site-select > span, .period-switch legend { color: var(--muted); font-size: 8px; font-weight: 650; }
.analytics-site-select select { height: 38px; font-size: 10px; }
.period-switch { display: grid; margin: 0; padding: 0; gap: 5px; border: 0; }
.period-switch > div { display: flex; padding: 3px; border: 1px solid var(--border); border-radius: 9px; background: #f8fafc; }
.period-switch button { min-height: 30px; padding: 0 11px; border: 0; border-radius: 6px; color: var(--muted); background: transparent; font-size: 8px; font-weight: 650; }
.period-switch button.is-active { color: #fff; background: var(--primary); box-shadow: 0 3px 8px rgba(59,130,246,.2); }
.analytics-date-range { margin-left: auto; padding-bottom: 9px; color: var(--muted); font-size: 8px; }
.analytics-kpis { display: grid; margin-bottom: 16px; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.analytics-kpis > .insight-empty { grid-column: 1 / -1; min-height: 135px; border: 1px solid var(--border); border-radius: 13px; background: #fff; }
.analytics-kpi { display: grid; min-height: 125px; padding: 16px; align-content: space-between; gap: 9px; border: 1px solid var(--border); border-radius: 13px; background: #fff; box-shadow: 0 3px 12px rgba(15,23,42,.035); }
.analytics-kpi header { display: flex; align-items: center; gap: 8px; }
.analytics-kpi__icon { display: grid; width: 28px; height: 28px; place-items: center; border-radius: 8px; color: #2563eb; background: #eff6ff; font-size: 9px; }
.analytics-kpi small { color: var(--muted); font-size: 8px; font-weight: 600; }
.analytics-kpi > strong { font-size: 23px; font-variant-numeric: tabular-nums; letter-spacing: -.05em; }
.analytics-delta { display: inline-flex; align-items: center; gap: 3px; color: #64748b; font-size: 7px; font-weight: 650; }
.analytics-delta.is-up { color: #15803d; }
.analytics-delta.is-down { color: #dc2626; }
.analytics-kpi.is-skeleton .skeleton:first-child { height: 28px; }
.analytics-kpi.is-skeleton .skeleton:last-child { height: 34px; }
.analytics-surface { padding: 0; overflow: hidden; }
.analytics-tabs { display: flex; padding: 0 14px; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--border); background: #f8fafc; }
.analytics-tabs button { position: relative; display: inline-flex; min-height: 54px; padding: 0 13px; flex: 0 0 auto; align-items: center; gap: 7px; border: 0; color: var(--muted); background: transparent; font-size: 9px; font-weight: 650; }
.analytics-tabs button::after { position: absolute; right: 10px; bottom: 0; left: 10px; height: 2px; content: ""; border-radius: 3px 3px 0 0; background: transparent; }
.analytics-tabs button.is-active { color: var(--primary); }
.analytics-tabs button.is-active::after { background: var(--primary); }
.analytics-panel { padding: 18px; }
.analytics-panel:not(.is-active) { display: none; }
.analytics-panel__heading { display: flex; min-height: 48px; margin-bottom: 10px; align-items: flex-start; justify-content: space-between; gap: 15px; }
.analytics-panel__heading h2 { margin: 0; font-size: 14px; }
.analytics-panel__heading p { margin: 5px 0 0; color: var(--muted); font-size: 8px; }
.analytics-source-label { display: inline-flex; min-height: 27px; padding: 0 8px; align-items: center; gap: 6px; border-radius: 8px; color: #dc2626; background: #fef2f2; font-size: 7px; font-weight: 650; }
.insight-chart--traffic { height: 390px; }
.sources-layout { display: grid; grid-template-columns: minmax(280px, .8fr) minmax(320px, 1.2fr); align-items: center; gap: 28px; }
.insight-chart--doughnut { height: 330px; }
.source-breakdown { display: grid; align-content: center; gap: 5px; }
.source-breakdown__row { display: flex; min-height: 48px; padding: 8px 10px; align-items: center; justify-content: space-between; gap: 15px; border-bottom: 1px solid #f1f5f9; }
.source-breakdown__row > span:first-child { display: inline-flex; align-items: center; gap: 8px; font-size: 9px; font-weight: 600; }
.source-breakdown__row > span:first-child i { width: 8px; height: 8px; border-radius: 50%; }
.source-breakdown__metrics { display: flex; align-items: baseline; gap: 8px; }
.source-breakdown__metrics strong { font-size: 11px; }
.source-breakdown__metrics small { min-width: 42px; color: var(--muted); font-size: 8px; text-align: right; }
.conversion-total { padding: 7px 10px; border-radius: 8px; color: #1d4ed8; background: #eff6ff; font-size: 9px; }
.goal-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.goal-grid > .insight-loading, .goal-grid > .insight-empty { grid-column: 1 / -1; }
.goal-card { display: grid; min-height: 170px; padding: 15px; align-content: start; gap: 9px; border: 1px solid var(--border); border-radius: 12px; background: #fff; }
.goal-card header { display: flex; min-width: 0; align-items: center; gap: 9px; }
.goal-card__icon { display: grid; width: 34px; height: 34px; flex: 0 0 34px; place-items: center; border-radius: 9px; color: #7c3aed; background: #f5f3ff; }
.goal-card header div { min-width: 0; }
.goal-card h3 { margin: 0; overflow: hidden; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.goal-card p { margin: 3px 0 0; color: var(--muted); font-size: 7px; }
.goal-card > strong { margin-top: 6px; font-size: 22px; font-variant-numeric: tabular-nums; }
.goal-card > small { color: var(--muted); font-size: 7px; }
.goal-card__progress { height: 5px; margin-top: auto; overflow: hidden; border-radius: 999px; background: #ede9fe; }
.goal-card__progress i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #8b5cf6, #3b82f6); }
.position-table-wrap { border: 1px solid var(--border); border-radius: 11px; }
.position-table th:nth-child(n+2), .position-table td:nth-child(n+2) { width: 130px; text-align: center; }
.position-keyword strong, .position-keyword small { display: block; }
.position-keyword small { max-width: 430px; margin-top: 3px; overflow: hidden; color: var(--muted); font-size: 7px; text-overflow: ellipsis; white-space: nowrap; }
.position-number { display: inline-grid; min-width: 33px; height: 29px; place-items: center; border-radius: 8px; color: #1d4ed8; background: #eff6ff; font-size: 10px; font-weight: 750; }
.position-change { display: inline-flex; min-width: 45px; align-items: center; justify-content: center; gap: 3px; font-size: 9px; font-weight: 700; }
.position-change.is-up { color: #15803d; }
.position-change.is-down { color: #dc2626; }
.position-change.is-same { color: #94a3b8; }
@keyframes status-pulse { 50% { box-shadow: 0 0 0 5px rgba(220,38,38,.12); } }

@media (min-width: 1550px) { .website-status-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 1120px) {
  .monitor-summary, .analytics-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .website-status-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .monitoring-detail { grid-template-columns: 1fr; }
  .monitoring-event-log { max-height: 260px; }
}
@media (max-width: 760px) {
  .analytics-toolbar { display: grid; grid-template-columns: 1fr; }
  .analytics-site-select { min-width: 0; }
  .analytics-date-range { margin-left: 0; padding: 0; }
  .sources-layout { grid-template-columns: 1fr; gap: 8px; }
  .goal-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .insight-chart--traffic { height: 320px; }
}
@media (max-width: 560px) {
  .monitor-summary, .analytics-kpis, .website-status-grid, .goal-grid { grid-template-columns: 1fr; }
  .section-heading { align-items: flex-start; flex-direction: column; }
  .status-legend { flex-wrap: wrap; }
  .monitor-summary-card { min-height: 82px; }
  .analytics-tabs { padding: 0 7px; }
  .analytics-tabs button { min-height: 49px; padding: 0 9px; }
  .analytics-panel { padding: 14px; }
  .analytics-panel__heading { align-items: flex-start; flex-direction: column; }
  .insight-chart--history, .insight-chart--traffic { height: 285px; }
}

/* Reports and finance */
.business-content { max-width: 1540px; margin: 0 auto; }
.business-content .page-heading__actions { flex-wrap: wrap; }
.business-panel-heading { display: flex; min-height: 70px; padding: 14px 16px; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--border); background: #f8fafc; }
.business-panel-heading > div:first-child { display: flex; min-width: 0; align-items: center; gap: 10px; }
.business-panel-heading h2 { margin: 0; font-size: 13px; }
.business-panel-heading p { margin: 4px 0 0; color: var(--muted); font-size: 8px; }
.business-panel-icon { display: grid; width: 36px; height: 36px; flex: 0 0 36px; place-items: center; border-radius: 10px; font-size: 11px; }
.business-panel-icon.is-blue { color: #2563eb; background: #dbeafe; }
.business-panel-icon.is-violet { color: #7c3aed; background: #ede9fe; }
.business-panel-icon.is-green { color: #15803d; background: #dcfce7; }
.business-panel-icon.is-orange { color: #c2410c; background: #ffedd5; }
.secure-note { display: inline-flex; align-items: center; gap: 6px; color: #64748b; font-size: 7px; font-weight: 600; }
.secure-note i { color: #16a34a; }
.report-builder { margin-bottom: 16px; padding: 0; overflow: hidden; }
.report-builder-form { display: grid; padding: 16px; grid-template-columns: repeat(4, minmax(150px, 1fr)); align-items: end; gap: 12px; }
.report-builder-form > label { display: grid; gap: 5px; }
.report-builder-form > label > span:first-child, .report-date-range label > span { color: var(--muted); font-size: 8px; font-weight: 650; }
.report-builder-form select, .report-builder-form input[type="date"] { height: 39px; font-size: 9px; }
.report-date-range { display: grid; grid-column: span 2; grid-template-columns: 1fr 1fr; gap: 10px; }
.report-date-range label { display: grid; gap: 5px; }
.report-custom-sections { display: flex; margin: 0; padding: 10px 12px; grid-column: 1 / -1; align-items: center; flex-wrap: wrap; gap: 9px 14px; border: 1px solid var(--border); border-radius: 10px; background: #f8fafc; }
.report-custom-sections legend { padding: 0 5px; color: #475569; font-size: 8px; font-weight: 700; }
.report-custom-sections label { display: inline-flex; align-items: center; gap: 5px; color: #475569; font-size: 8px; }
.report-custom-sections input { width: 14px; height: 14px; accent-color: var(--primary); }
.report-send-option { display: flex !important; min-height: 42px; padding: 7px 10px; grid-column: span 2; grid-template-columns: auto 1fr; align-items: center; gap: 8px !important; border: 1px solid var(--border); border-radius: 9px; background: #f8fafc; cursor: pointer; }
.report-send-option input { width: 15px; height: 15px; accent-color: var(--primary); }
.report-send-option span { display: grid; gap: 2px; }
.report-send-option strong { color: #475569; font-size: 8px; }
.report-send-option small { color: var(--muted); font-size: 7px; }
.report-generate-button { min-height: 42px; grid-column: span 2; }
.business-table-panel { padding: 0; overflow: hidden; }
.business-filter select { min-width: 180px; height: 35px; font-size: 8px; }
.business-table { min-width: 780px; }
.business-table th { white-space: nowrap; }
.business-table .actions-column { width: 178px; text-align: right; }
.business-primary-cell { display: flex; min-width: 230px; align-items: center; gap: 9px; }
.business-primary-cell > div { min-width: 0; }
.business-primary-cell strong, .business-primary-cell small { display: block; }
.business-primary-cell strong { max-width: 380px; overflow: hidden; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.business-primary-cell small { margin-top: 3px; color: var(--muted); font-size: 7px; }
.document-icon { display: grid; width: 32px; height: 32px; flex: 0 0 32px; place-items: center; border-radius: 9px; color: #dc2626; background: #fef2f2; font-size: 11px; }
.document-icon.is-invoice { color: #15803d; background: #f0fdf4; }
.business-status, .invoice-status, .expense-category { display: inline-flex; min-height: 25px; padding: 0 8px; align-items: center; border-radius: 999px; font-size: 7px; font-weight: 700; white-space: nowrap; }
.business-status.is-success { color: #15803d; background: #dcfce7; }
.business-status.is-neutral { color: #64748b; background: #f1f5f9; }
.table-actions { display: flex; align-items: center; justify-content: flex-end; gap: 5px; }
.table-action { display: grid; width: 29px; height: 29px; padding: 0; place-items: center; border: 1px solid var(--border); border-radius: 8px; color: #64748b; background: #fff; font-size: 8px; transition: color var(--transition), border-color var(--transition), background var(--transition), transform var(--transition); }
.table-action:hover { color: var(--primary); border-color: #93c5fd; background: #eff6ff; transform: translateY(-1px); }
.table-action.is-primary { color: #2563eb; border-color: #bfdbfe; background: #eff6ff; }
.table-action.is-success { color: #15803d; border-color: #bbf7d0; background: #f0fdf4; }
.table-action.is-danger { color: #dc2626; border-color: #fecaca; background: #fef2f2; }
.table-loading { display: flex; min-height: 150px; align-items: center; justify-content: center; gap: 8px; color: var(--muted); font-size: 9px; }
.business-empty { display: grid; width: 100%; min-height: 145px; padding: 25px; place-items: center; align-content: center; gap: 7px; color: var(--muted); text-align: center; }
.business-empty > i { color: #cbd5e1; font-size: 23px; }
.business-empty strong { color: #475569; font-size: 10px; }
.business-empty p { max-width: 430px; margin: 0; font-size: 8px; line-height: 1.55; }
.report-preview-dialog { width: min(1180px, 96vw); }
.report-preview-frame-wrap { position: relative; min-height: 68vh; background: #e2e8f0; }
.report-preview-frame { border: 0; }
#report-preview-frame { display: block; width: 100%; min-height: 68vh; border: 0; background: #fff; }
.report-preview-loading { position: absolute; inset: 0; z-index: 2; display: grid; place-items: center; align-content: center; gap: 8px; color: var(--muted); background: #f8fafc; font-size: 9px; }

.finance-summary-grid { display: grid; margin-bottom: 16px; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.finance-summary-grid > .business-empty { grid-column: 1 / -1; min-height: 130px; border: 1px solid var(--border); border-radius: 13px; background: #fff; }
.finance-summary-card { display: grid; min-height: 133px; padding: 16px; align-content: space-between; gap: 8px; border: 1px solid var(--border); border-radius: 13px; background: #fff; box-shadow: 0 3px 12px rgba(15,23,42,.035); }
.finance-summary-card header { display: flex; align-items: center; gap: 8px; }
.finance-summary-card header small { color: var(--muted); font-size: 8px; font-weight: 600; }
.finance-summary-icon { display: grid; width: 31px; height: 31px; place-items: center; border-radius: 9px; font-size: 9px; }
.finance-summary-icon.is-green { color: #15803d; background: #dcfce7; }
.finance-summary-icon.is-red { color: #dc2626; background: #fee2e2; }
.finance-summary-icon.is-blue { color: #2563eb; background: #dbeafe; }
.finance-summary-icon.is-orange { color: #c2410c; background: #ffedd5; }
.finance-summary-card > strong { font-size: 21px; font-variant-numeric: tabular-nums; letter-spacing: -.04em; }
.finance-summary-card p { margin: 0; color: var(--muted); font-size: 7px; }
.finance-summary-card.is-skeleton .skeleton:first-child { height: 31px; }
.finance-summary-card.is-skeleton .skeleton:last-child { height: 35px; }
.project-health-surface { margin-bottom: 16px; padding: 0; overflow: hidden; }
.project-health-grid { display: grid; padding: 14px; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 11px; border-top: 1px solid var(--border); background: #f8fafc; }
.project-health-grid > .business-empty { grid-column: 1 / -1; min-height: 150px; }
.project-health-card { display: grid; min-width: 0; padding: 14px; gap: 12px; border: 1px solid var(--border); border-radius: 12px; background: #fff; box-shadow: 0 3px 12px rgba(15,23,42,.035); }
.project-health-card.is-excellent { border-top: 3px solid #22c55e; }
.project-health-card.is-normal { border-top: 3px solid #f59e0b; }
.project-health-card.is-poor { border-top: 3px solid #ef4444; }
.project-health-card.is-skeleton .skeleton { height: 24px; }
.project-health-card.is-skeleton .skeleton:nth-child(2) { height: 8px; }
.project-health-card.is-skeleton .skeleton:last-child { height: 55px; }
.project-health-head { display: flex; min-width: 0; align-items: center; gap: 9px; }
.project-health-dot { width: 10px; height: 10px; flex: 0 0 10px; border-radius: 50%; box-shadow: 0 0 0 4px currentColor; }
.project-health-dot.is-excellent { color: rgba(34,197,94,.16); background: #22c55e; }
.project-health-dot.is-normal { color: rgba(245,158,11,.16); background: #f59e0b; }
.project-health-dot.is-poor { color: rgba(239,68,68,.16); background: #ef4444; }
.project-health-title { min-width: 0; flex: 1; }
.project-health-title strong, .project-health-title small { display: block; }
.project-health-title strong { overflow: hidden; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.project-health-title small { margin-top: 2px; color: var(--muted); font-size: 7px; }
.project-health-status { padding: 4px 7px; border-radius: 999px; font-size: 7px; font-weight: 750; white-space: nowrap; }
.project-health-status.is-excellent { color: #15803d; background: #dcfce7; }
.project-health-status.is-normal { color: #a16207; background: #fef3c7; }
.project-health-status.is-poor { color: #b91c1c; background: #fee2e2; }
.project-health-margin { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.project-health-margin span { color: var(--muted); font-size: 7px; }
.project-health-margin strong { font-size: 18px; font-variant-numeric: tabular-nums; letter-spacing: -.04em; }
.project-health-progress { height: 7px; overflow: hidden; border-radius: 999px; background: #e2e8f0; }
.project-health-progress span { display: block; width: 0; height: 100%; border-radius: inherit; transition: width .35s ease; }
.project-health-progress.is-excellent span { background: #22c55e; }
.project-health-progress.is-normal span { background: #f59e0b; }
.project-health-progress.is-poor span { background: #ef4444; }
.project-health-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
.project-health-stat { min-width: 0; padding: 8px; border-radius: 8px; background: #f8fafc; }
.project-health-stat span, .project-health-stat strong { display: block; }
.project-health-stat span { color: var(--muted); font-size: 6px; }
.project-health-stat strong { margin-top: 3px; overflow: hidden; font-size: 8px; font-variant-numeric: tabular-nums; text-overflow: ellipsis; white-space: nowrap; }
.project-health-hours { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 7px; }
.project-health-hours.is-over { color: #dc2626; font-weight: 700; }
.finance-surface { padding: 0; overflow: hidden; }
.finance-tabs { display: flex; padding: 0 14px; gap: 5px; border-bottom: 1px solid var(--border); background: #f8fafc; }
.finance-tabs button { position: relative; display: inline-flex; min-height: 52px; padding: 0 13px; align-items: center; gap: 7px; border: 0; color: var(--muted); background: transparent; font-size: 9px; font-weight: 650; }
.finance-tabs button::after { position: absolute; right: 9px; bottom: 0; left: 9px; height: 2px; content: ""; background: transparent; }
.finance-tabs button.is-active { color: var(--primary); }
.finance-tabs button.is-active::after { background: var(--primary); }
.finance-tabs button span { display: grid; min-width: 20px; height: 20px; padding: 0 5px; place-items: center; border-radius: 999px; color: #64748b; background: #e2e8f0; font-size: 7px; }
.finance-panel:not(.is-active) { display: none; }
.finance-table { min-width: 1040px; }
.money-cell { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.is-overdue { color: #dc2626 !important; font-weight: 700; }
.invoice-status.is-paid { color: #15803d; background: #dcfce7; }
.invoice-status.is-sent { color: #a16207; background: #fef3c7; }
.invoice-status.is-overdue { color: #b91c1c; background: #fee2e2; }
.invoice-status.is-draft { color: #475569; background: #e2e8f0; }
.invoice-status.is-cancelled { color: #64748b; background: #f1f5f9; }
.expense-category.is-advertising { color: #7c3aed; background: #ede9fe; }
.expense-category.is-hosting { color: #2563eb; background: #dbeafe; }
.expense-category.is-services { color: #0369a1; background: #e0f2fe; }
.expense-category.is-salary { color: #c2410c; background: #ffedd5; }
.expense-category.is-other { color: #64748b; background: #f1f5f9; }
.business-description-cell { min-width: 220px; }
.business-description-cell strong, .business-description-cell small { display: block; }
.business-description-cell strong { max-width: 360px; overflow: hidden; font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.business-description-cell small { margin-top: 3px; color: var(--muted); font-size: 7px; }
.form-note { display: flex; margin: 0; padding: 10px; align-items: center; gap: 7px; border-radius: 9px; color: #475569; background: #eff6ff; font-size: 8px; }
.form-note i { color: #dc2626; }

@media (max-width: 1180px) {
  .report-builder-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .finance-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .project-health-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 680px) {
  .business-panel-heading { align-items: flex-start; flex-direction: column; }
  .business-filter, .business-filter select { width: 100%; }
  .report-builder-form { grid-template-columns: 1fr; }
  .report-date-range { grid-column: auto; grid-template-columns: 1fr; }
  .report-send-option, .report-generate-button { grid-column: auto; }
  .finance-summary-grid { grid-template-columns: 1fr; }
  .project-health-grid { grid-template-columns: 1fr; }
  .finance-tabs { overflow-x: auto; }
  .report-preview-frame-wrap, #report-preview-frame { min-height: 62vh; }
}

/* Collapsed desktop sidebar */
.app-shell.sidebar-collapsed .sidebar { width: var(--sidebar-collapsed); }
.app-shell.sidebar-collapsed .workspace { margin-left: var(--sidebar-collapsed); }
.app-shell.sidebar-collapsed .brand__copy, .app-shell.sidebar-collapsed .sidebar__caption, .app-shell.sidebar-collapsed .nav-link > span, .app-shell.sidebar-collapsed .sidebar__status > span:last-child { display: none; }
.app-shell.sidebar-collapsed .sidebar__brand { justify-content: center; }
.app-shell.sidebar-collapsed .nav-link { padding: 0; justify-content: center; }
.app-shell.sidebar-collapsed .nav-link:hover { transform: none; }
.app-shell.sidebar-collapsed .sidebar__status { justify-content: center; }

/* Login */
.login-page { min-height: 100vh; color: #e2e8f0; background: radial-gradient(circle at 15% 20%, rgba(59,130,246,.2), transparent 27%), radial-gradient(circle at 84% 78%, rgba(14,165,233,.12), transparent 25%), linear-gradient(145deg, #0f172a 0%, #1e293b 58%, #111827 100%); }
.login-page::before { position: fixed; inset: 0; content: ""; opacity: .12; pointer-events: none; background-image: linear-gradient(rgba(255,255,255,.08) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.08) 1px, transparent 1px); background-size: 42px 42px; mask-image: linear-gradient(to bottom, black, transparent 90%); }
.login-shell { position: relative; z-index: 1; display: grid; width: 100%; min-height: 100vh; padding: 28px 18px; place-items: center; align-content: center; gap: 18px; }
.login-card { width: min(430px, 100%); padding: 34px; border: 1px solid rgba(255,255,255,.12); border-radius: 22px; color: var(--text); background: rgba(255,255,255,.98); box-shadow: 0 28px 90px rgba(2,6,23,.42); }
.login-brand { display: flex; margin-bottom: 30px; align-items: center; gap: 12px; }
.login-brand > span:last-child { display: flex; align-items: baseline; gap: 5px; }
.login-brand strong { font-size: 22px; letter-spacing: -.05em; }
.login-brand small { color: var(--primary); font-size: 11px; font-weight: 800; letter-spacing: .14em; }
.login-card__heading { margin-bottom: 24px; }
.eyebrow { margin: 0 0 7px !important; color: var(--primary) !important; font-size: 9px !important; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.login-card__heading h1 { margin: 0; font-size: 25px; letter-spacing: -.04em; }
.login-card__heading p { margin: 8px 0 0; color: var(--muted); font-size: 11px; }
.login-form { display: grid; gap: 15px; }
.login-form .btn { min-height: 46px; margin-top: 4px; }
.login-card__footer { display: flex; margin: 24px -34px -34px; padding: 15px 20px; align-items: center; justify-content: center; gap: 8px; border-top: 1px solid var(--border); border-radius: 0 0 22px 22px; color: var(--muted); background: #f8fafc; font-size: 9px; }
.login-help { margin: 0; color: #94a3b8; font-size: 10px; }
.login-help a { color: #bfdbfe; font-weight: 600; }

@keyframes modal-in { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes toast-in { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { to { background-position: -200% 0; } }

@media (max-width: 1180px) {
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid--wide { grid-template-columns: minmax(0, 1fr); }
  .monitor-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .sidebar { width: min(var(--sidebar-width), 86vw); box-shadow: 30px 0 70px rgba(15,23,42,.28); transform: translateX(-105%); }
  .sidebar.is-open { transform: translateX(0); }
  .sidebar__close { display: grid; }
  .workspace, .app-shell.sidebar-collapsed .workspace { margin-left: 0; }
  .app-shell.sidebar-collapsed .sidebar { width: min(var(--sidebar-width), 86vw); }
  .app-shell.sidebar-collapsed .brand__copy, .app-shell.sidebar-collapsed .sidebar__caption, .app-shell.sidebar-collapsed .nav-link > span, .app-shell.sidebar-collapsed .sidebar__status > span:last-child { display: initial; }
  .app-shell.sidebar-collapsed .sidebar__brand { justify-content: space-between; }
  .app-shell.sidebar-collapsed .nav-link { padding: 0 12px; justify-content: flex-start; }
  .app-shell.sidebar-collapsed .sidebar__status { justify-content: flex-start; }
  .topbar { padding: 0 18px; }
  .global-search { width: min(440px, 48vw); }
  .content { padding: 26px 22px 42px; }
  .settings-layout { grid-template-columns: 1fr; }
  .settings-nav { grid-template-columns: repeat(3, 1fr); border-right: 0; border-bottom: 1px solid var(--border); }
}

@media (max-width: 680px) {
  .topbar { height: 64px; padding: 0 13px; }
  .global-search { position: fixed; top: 72px; right: 14px; left: 14px; z-index: 90; display: none; width: auto; padding: 8px; border: 1px solid var(--border); border-radius: 12px; background: #fff; box-shadow: var(--shadow-lg); }
  .global-search.is-open { display: flex; }
  .profile-button__copy, .profile-button > i { display: none; }
  .profile-button { padding: 2px; }
  .mobile-search-toggle { display: grid; }
  .topbar__actions { gap: 6px; }
  .content { padding: 22px 14px 36px; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .page-heading__actions { width: 100%; }
  .page-heading__actions .btn { flex: 1; }
  .stat-grid, .grid--2, .grid--3, .monitor-grid { grid-template-columns: 1fr; }
  .stat-card { min-height: 118px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-group--full { grid-column: auto; }
  .filter-bar { align-items: stretch; flex-direction: column; }
  .filter-bar input, .filter-bar select { width: 100%; }
  .settings-nav { display: flex; overflow-x: auto; }
  .settings-nav button { flex: 0 0 auto; }
  .service-grid { grid-template-columns: 1fr; }
  .login-card { padding: 27px 22px; }
  .login-card__footer { margin: 24px -22px -27px; }
  .toast-container { right: 15px; bottom: 15px; }
}

@media (max-width: 410px) {
  .notification-btn { border-color: transparent; }
  .stat-grid { gap: 11px; }
  .page-heading h1 { font-size: 24px; }
  .modal { padding: 10px; }
  .modal__dialog { max-height: calc(100vh - 20px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

@media print {
  .sidebar, .topbar, .page-heading__actions, .toast-container { display: none !important; }
  .workspace { margin: 0; }
  .content { padding: 0; }
  body { background: #fff; }
  .card, .panel { box-shadow: none; }
}
