:root {
    color-scheme: light;
    font-family: "Inter", "Segoe UI", system-ui, sans-serif;
    color: #152536;
    background: #f4f7fa;
    --muted: #526579;
    --line: #dfe7ed;
    --accent: #086987;
    --accent-dark: #07536b;
    --accent-soft: #e9f5f8;
    --accent-line: #cfe6ed;
    --sidebar: 224px;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 320px; font-size: 14px; }
a { color: inherit; text-decoration: none; }
button, input, textarea { font: inherit; }
button, summary { cursor: pointer; }
button:disabled { cursor: wait; opacity: .65; }
svg { flex: none; }
h1, h2, h3, p { margin: 0; }
:focus-visible { outline: 2px solid #258ba9; outline-offset: 3px; }

.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar); display: flex; flex-direction: column; padding: 24px 16px 19px; background: #142536; color: #f2f7fb; }
.brand { display: block; width: 100%; }
.brand img { display: block; width: 100%; height: auto; }
.side-nav { margin-top: 34px; display: grid; gap: 5px; }
.nav-label { padding: 0 12px 8px; color: #9db1c3; font-size: 10px; font-weight: 700; letter-spacing: .13em; }
.nav-link { display: flex; align-items: center; gap: 11px; min-height: 43px; border-radius: 9px; padding: 0 11px; color: #c1d1de; font-size: 13px; font-weight: 540; white-space: nowrap; }
.nav-link svg { width: 17px; height: 17px; }
.nav-link:hover { background: #20384b; color: #fff; }
.nav-link.active { color: #f2fafe; background: #21465c; }
.nav-link.active svg { color: #96d7eb; }
.sidebar-footer { display: flex; align-items: center; gap: 10px; padding: 17px 4px 0; margin-top: auto; border-top: 1px solid #31495d; }
.team-avatar { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: #21465c; color: #ccedf6; font-size: 11px; font-weight: 750; }
.sidebar-footer strong, .sidebar-footer small { display: block; line-height: 1.45; }
.sidebar-footer strong { font-size: 12px; }
.sidebar-footer small { color: #a6b9c9; font-size: 11px; }

.shell { margin-left: var(--sidebar); }
.topbar { display: flex; align-items: center; justify-content: space-between; min-height: 62px; padding: 0 clamp(20px, 3vw, 42px); background: #fff; border-bottom: 1px solid var(--line); }
.breadcrumbs, .top-date { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 12px; }
.breadcrumbs strong { color: #152536; font-weight: 680; }
.breadcrumbs svg { width: 13px; height: 13px; color: #8297a9; }
.top-date svg { width: 16px; height: 16px; color: var(--accent); }
.topbar-actions { display: flex; align-items: center; gap: 14px; }
.button.sign-out { min-height: 30px; padding-inline: 9px; font-size: 12px; }
.content { max-width: 1500px; margin: auto; padding: 28px clamp(20px, 3vw, 42px) 20px; }
.hero { position: relative; isolation: isolate; display: flex; align-items: center; min-height: 210px; padding: 27px 30px; overflow: hidden; background: linear-gradient(105deg, #f1f8fb, #e0eff6); border: 1px solid var(--accent-line); border-radius: 16px; }
.hero-copy { max-width: 100%; z-index: 1; }
.eyebrow { display: inline-flex; align-items: center; gap: 6px; color: var(--accent-dark); font-size: 10px; font-weight: 760; letter-spacing: .115em; }
.eyebrow > span { width: 6px; height: 6px; border-radius: 50%; background: #258ba9; }
.hero h1 { margin: 9px 0 7px; color: #12283c; font-size: clamp(31px, 3.1vw, 47px); line-height: 1.08; letter-spacing: -.05em; }
.hero p { max-width: 490px; color: #435a6e; font-size: 14px; line-height: 1.55; }
.hero .button { margin-top: 18px; }
.hero-art { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); width: min(41%, 420px); height: auto; z-index: -1; }

.button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 39px; padding: 0 13px; border: 1px solid transparent; border-radius: 8px; font-weight: 650; font-size: 13px; line-height: 1.2; white-space: nowrap; transition: background .15s, border-color .15s; }
.button svg { width: 17px; height: 17px; }
.primary { color: #fff; background: var(--accent); border-color: var(--accent); box-shadow: 0 2px 5px #123d5424; }
.primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.secondary { color: var(--accent-dark); background: #f7fbfd; border-color: var(--accent-line); }
.secondary:hover { background: var(--accent-soft); border-color: #badce7; }
.danger { background: #ad2b4b; color: #fff; }
.danger:hover { background: #96223f; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: 13px; box-shadow: 0 1px 2px #1425360a; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-top: 17px; }
.stat { display: flex; align-items: flex-start; gap: 11px; min-height: 106px; padding: 16px 14px; transition: border-color .15s, box-shadow .15s; }
.stat:hover { border-color: #badce7; box-shadow: 0 3px 8px #1425360d; }
.stat-icon { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; flex: none; }
.stat-icon svg { width: 17px; height: 17px; }
.blue, .tone-0 { background: var(--accent-soft); color: var(--accent); }
.amber { background: #fff2da; color: #946020; }
.rose, .tone-3 { background: #ffe9ee; color: #b03958; }
.green, .tone-2 { background: #e3f7ed; color: #237453; }
.tone-1 { background: #e6f0fd; color: #3765ab; }
.stat-label, .stat strong, .stat small { display: block; }
.stat-label { font-size: 12px; color: var(--muted); font-weight: 640; }
.stat strong { font-size: 27px; line-height: 1.2; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.stat small { margin-top: 3px; font-size: 11px; line-height: 1.35; color: var(--muted); }

.records { margin-top: 19px; scroll-margin-top: 12px; }
.section-header { display: flex; align-items: center; justify-content: space-between; gap: 13px; padding: 18px 19px 15px; }
.section-header h2 { font-size: 19px; line-height: 1.3; letter-spacing: -.03em; }
.section-header p { color: var(--muted); margin-top: 3px; font-size: 12px; line-height: 1.4; }
.search { display: flex; align-items: center; min-width: 180px; width: 218px; min-height: 36px; background: #fafcfd; border: 1px solid var(--line); border-radius: 8px; }
.search:focus-within { border-color: var(--accent); }
.search input { order: 2; flex: 1; min-width: 0; padding: 7px 8px 7px 0; border: 0; background: transparent; color: #152536; outline: none; font-size: 12px; }
.search input::placeholder { color: var(--muted); }
.search button { display: grid; place-items: center; width: 34px; height: 34px; border: 0; background: none; color: var(--muted); }
.search button svg { width: 17px; height: 17px; }
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 0 19px 13px; }
.filter { padding: 6px 9px; border-radius: 7px; color: var(--muted); font-size: 12px; font-weight: 590; white-space: nowrap; }
.filter:hover { background: #f0f5f8; }
.filter.selected { background: var(--accent-soft); color: var(--accent-dark); }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-spacing: 0; min-width: 750px; font-size: 13px; }
th, td { padding: 10px 11px; text-align: left; vertical-align: middle; }
th:first-child, td:first-child { padding-left: 19px; }
th:last-child, td:last-child { padding-right: 19px; }
th { font-size: 11px; font-weight: 700; letter-spacing: .035em; color: var(--muted); background: #f5f8fa; border-block: 1px solid var(--line); white-space: nowrap; }
td { height: 59px; color: #354b5e; border-bottom: 1px solid #ecf1f4; }
td strong { color: #152536; font-weight: 650; overflow-wrap: anywhere; }
td small { display: block; color: var(--muted); margin-top: 3px; font-size: 11px; }
tbody tr:hover { background: #f7fbfd; }
.client { display: flex; align-items: center; gap: 9px; min-width: 145px; }
.initial { display: grid; place-items: center; flex: none; width: 33px; height: 33px; border-radius: 9px; font-weight: 730; font-size: 13px; }
.due-date { white-space: nowrap; }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 4px 7px; border-radius: 20px; white-space: nowrap; font-size: 11px; font-weight: 650; }
.badge::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.badge.upcoming { background: #fff3df; color: #895414; }
.badge.overdue { background: #ffedf1; color: #ad2e4c; }
.badge.current { background: #eaf8ee; color: #247144; }
.row-actions, .pagination { display: flex; align-items: center; justify-content: flex-end; gap: 5px; }
.actions-heading { text-align: right; }
.whatsapp-button, .icon-button { display: inline-flex; align-items: center; justify-content: center; min-height: 32px; border: 1px solid var(--line); border-radius: 7px; color: var(--muted); }
.whatsapp-button { gap: 4px; padding: 0 7px; background: #f0fbf4; border-color: #d9f0e1; color: #226b48; font-size: 11px; font-weight: 690; }
.whatsapp-button:hover { background: #e4f7eb; border-color: #c6e9d2; }
.whatsapp-button svg { width: 15px; height: 15px; }
.icon-button { width: 32px; flex: none; background: #fff; }
.icon-button:hover { color: var(--accent-dark); background: var(--accent-soft); border-color: var(--accent-line); }
.icon-button svg { width: 15px; height: 15px; }
.table-footer { display: flex; align-items: center; justify-content: space-between; min-height: 45px; padding: 5px 19px; color: var(--muted); font-size: 11px; }
.empty { padding: 32px 18px; text-align: center; }
.records .empty { border-top: 1px solid var(--line); }
.empty-icon { display: inline-grid; place-items: center; width: 46px; height: 46px; border-radius: 13px; background: var(--accent-soft); color: var(--accent); }
.empty-icon svg { width: 22px; height: 22px; }
.empty h1, .empty h3 { margin-top: 9px; font-size: 17px; }
.empty p { margin-top: 5px; color: var(--muted); line-height: 1.5; font-size: 13px; }
.empty .button { margin-top: 13px; }
.notice { display: flex; align-items: flex-start; gap: 9px; margin-top: 17px; border-radius: 8px; border: 1px solid var(--accent-line); padding: 11px 13px; background: var(--accent-soft); color: var(--accent-dark); line-height: 1.45; }
.notice svg { width: 17px; height: 17px; margin-top: 1px; }
.notice p { margin-top: 2px; font-size: 12px; }
.notice.success { background: #e9f8ee; border-color: #ccebd7; color: #276843; }
.notice.pending { background: #fff7e8; border-color: #f4e3c3; color: #805318; }
.notice.error { background: #fff0f3; border-color: #f5d9e1; color: #a5314e; }
.records > .notice { margin-inline: 19px; }
.log-detail { overflow-wrap: anywhere; }
.workspace-footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 11px; padding-top: 15px; }
.workspace-footer i { display: inline-block; width: 3px; height: 3px; margin: 0 4px 2px; background: #7c9bad; border-radius: 50%; }

.dialog { border: 1px solid var(--line); border-radius: 15px; padding: 0; position: fixed; inset: 0; margin: auto; width: min(535px, calc(100% - 30px)); max-height: calc(100dvh - 36px); color: #152536; background: #fff; box-shadow: 0 24px 72px #12263935; z-index: 5; overflow: auto; }
.dialog[open]:not(:modal) { box-shadow: 0 0 0 100vmax #12263973, 0 24px 72px #12263935; }
.dialog::backdrop { background: #12263973; }
.dialog-content { padding: 22px; }
.dialog-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 13px; }
.dialog-header h2 { font-size: 22px; letter-spacing: -.035em; }
.dialog-header p, .dialog-description { margin-top: 5px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.dialog-form { margin-top: 17px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.field { display: grid; align-content: start; gap: 5px; color: #354b5e; font-size: 12px; font-weight: 630; }
.field.full { grid-column: 1 / -1; }
.field input, .field textarea { border: 1px solid #d3dfe7; border-radius: 7px; width: 100%; min-width: 0; min-height: 38px; padding: 7px 9px; background: #fafcfd; color: #152536; font-size: 13px; font-weight: 400; }
.field textarea { resize: vertical; }
.field [aria-invalid="true"] { border-color: #b9405b; }
.error-text { color: #a5314e; font-size: 11px; }
.dialog-description + .field { margin-top: 12px; }
.message-preview { margin-top: 11px; padding: 13px; border-radius: 9px; color: #2c4a3a; background: #edf9f0; line-height: 1.55; overflow-wrap: anywhere; }
.message-preview + .dialog-description { margin-top: 11px; }
.dialog-actions { display: flex; justify-content: flex-end; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.delete-link { display: inline-flex; align-items: center; gap: 5px; margin-right: auto; padding: 7px 0; color: #aa3450; font-size: 12px; }
.delete-link svg { width: 15px; height: 15px; }
.history { margin-top: 12px; padding: 9px; border-radius: 7px; background: #f1f7fa; color: #354b5e; font-size: 12px; }
.history ul { margin: 7px 0 0; padding-left: 18px; line-height: 1.6; }
.history small { color: var(--muted); }

.sign-in-shell { display: grid; place-items: center; min-height: 100dvh; padding: 20px; background: radial-gradient(ellipse at top, #e0eff6, #f4f7fa 70%); }
.sign-in-panel { width: min(100%, 420px); padding: clamp(22px, 6vw, 34px); box-shadow: 0 16px 40px #1425360e; }
.sign-in-panel img { display: block; }
.sign-in-panel h1 { margin: 12px 0 20px; font-size: 25px; line-height: 1.16; letter-spacing: -.035em; }
.sign-in-form { display: grid; gap: 10px; }
.sign-in-form button { margin-top: 5px; min-height: 42px; }

@media (max-width: 1050px) {
    :root { --sidebar: 194px; }
    .stat { padding: 13px 10px; gap: 7px; }
    .stat-icon { width: 29px; height: 29px; }
    .hero-art { width: 34%; }
}

@media (max-width: 820px) {
    .sidebar { position: static; width: 100%; padding: 11px 16px 8px; }
    .brand { width: 165px; }
    .side-nav { display: flex; margin-top: 8px; gap: 5px; overflow-x: auto; }
    .nav-link { min-height: 36px; font-size: 12px; }
    .nav-label, .sidebar-footer { display: none; }
    .shell { margin-left: 0; }
    .topbar { min-height: 47px; }
    .content { padding-top: 16px; }
}

@media (max-width: 740px) {
    .renewal-table { display: block; min-width: 0; }
    .renewal-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
    .renewal-table tbody { display: block; border-top: 1px solid #eef0f5; }
    .renewal-table tbody tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px 10px; padding: 13px; border-bottom: 1px solid #eef0f5; }
    .renewal-table td { height: auto; border: 0; padding: 0; overflow-wrap: anywhere; }
    .renewal-table td:nth-child(1) { grid-area: 1 / 1; }
    .renewal-table td:nth-child(2) { grid-area: 2 / 1; }
    .renewal-table td:nth-child(3) { grid-area: 3 / 1; }
    .renewal-table td:nth-child(4) { grid-area: 2 / 2; text-align: right; }
    .renewal-table td:nth-child(5) { grid-area: 1 / 2; text-align: right; }
    .renewal-table td:nth-child(6) { grid-area: 3 / 2; }
    .renewal-table .client { min-width: 0; }
}

@media (max-width: 570px) {
    .topbar, .content { padding-inline: 12px; }
    .hero { min-height: 182px; padding: 17px; }
    .hero h1 { font-size: 33px; }
    .hero-art { display: none; }
    .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
    .stat { min-height: 91px; }
    .section-header { flex-wrap: wrap; padding-inline: 12px; }
    .search { width: 100%; }
    .filters { padding-inline: 12px; }
    .filter { padding-inline: 7px; }
    .workspace-footer { font-size: 10px; }
}

@media (max-width: 440px) {
    .dialog-content { padding: 16px; }
    .form-grid { grid-template-columns: minmax(0, 1fr); }
    .topbar-actions .top-date { display: none; }
}
