:root {
    --purple: #7468ff;
    --purple-2: #6d5ef7;
    --blue: #1a4b8f;
    --navy: #0a3260;
    --gold: #f0b429;
    --orange: #e87a22;
    --bg: #e8edf4;
    --white: #fff;
    --text: #1e2430;
    --muted: #8b93a7;
    --line: #dce3ec;
    --green: #3dcf8e;
    --cyan: #4ec6e8;
    --red: #e45b5b;
    --sidebar: 250px;
    --shadow: 0 8px 24px rgba(15, 40, 80, .08);
    --radius: 8px;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); }
[hidden] { display: none !important; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

/* Login */
.login-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: #eef2f8;
}
.login-card {
    width: min(440px, 92vw);
    background: #fff;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 18px 50px rgba(70, 80, 120, .15);
}
.login-head {
    background: #0a2c4d;
    color: #fff;
    text-align: center;
    padding: 28px 24px 24px;
}
.login-head img {
    display: block;
    width: min(340px, 100%);
    height: auto;
    margin: 0 auto;
}
.login-head p { margin: 12px 0 0; opacity: .92; font-size: 15px; }
.login-form { padding: 28px 32px 36px; }
.login-form label { display: block; color: #7b8499; margin: 12px 0 6px; }
.login-form input[type=email],
.login-form input[type=password] {
    width: 100%;
    border: 0;
    background: #eaf0ff;
    border-radius: 8px;
    padding: 12px 14px;
    outline: none;
}
.login-row { display: flex; justify-content: space-between; align-items: center; margin: 16px 0 22px; gap: 12px; }
.check { display: flex; align-items: center; gap: 8px; color: #6b7386; font-size: 14px; }
.link-btn { background: none; border: 0; color: #4d6dff; font-size: 13px; }
.btn-ingresar {
    width: 100%;
    border: 0;
    background: #fff;
    border-radius: 999px;
    padding: 14px;
    box-shadow: 0 8px 18px rgba(80, 90, 140, .12);
    letter-spacing: .08em;
    color: #5c6478;
    display: flex;
    justify-content: center;
    gap: 10px;
}

/* App shell */
body.is-app {
    min-height: 100vh;
    background: #e8edf4;
}
.app-shell {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding: 0;
}
.topbar {
    height: 72px;
    background: var(--navy);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 22px;
    box-shadow: 0 2px 8px rgba(8, 30, 60, .18);
    z-index: 5;
}
.brand-logo img { height: 52px; width: auto; display: block; }
.topbar-left { display: flex; align-items: center; gap: 8px; min-width: 0; }
.topbar-left .brand-logo { min-width: 0; }
#btn-sidebar { flex-shrink: 0; }
.app-shell.is-collapsed .sidebar { display: none; }
.app-shell.is-collapsed .app-main { width: 100%; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.icon-btn {
    width: 36px; height: 36px; border: 0; background: transparent; border-radius: 8px; color: #6a7388;
    display: grid; place-items: center; position: relative;
}
.icon-btn:hover { background: #f3f5fa; }
.icon-btn.light { color: #fff; }
.icon-btn.light:hover { background: rgba(255,255,255,.12); }
.has-badge .badge, .mini-badge {
    position: absolute; top: 2px; right: 2px;
    background: #f97316; color: #fff; font-size: 10px; min-width: 16px; height: 16px;
    border-radius: 99px; display: grid; place-items: center; padding: 0 4px;
}
.user-card {
    display: flex;
    align-items: center;
    gap: 10px;
    background: transparent;
    border: 0;
    color: #fff;
    text-align: right;
    padding: 4px;
}
.user-copy { display: flex; flex-direction: column; }
.user-copy strong { font-size: 14px; }
.user-copy small { opacity: .85; font-size: 12px; }
.avatar {
    width: 42px; height: 42px; border-radius: 50%;
    background: #e8f1ff; color: #0a3a72;
    display: grid; place-items: center; font-weight: 700; border: 2px solid #fff;
}

.app-row { display: flex; gap: 0; align-items: stretch; flex: 1; min-height: 0; }
.sidebar {
    width: 230px;
    background: #eef2f6;
    border-radius: 0;
    border-right: 1px solid #dde3ea;
    padding: 18px 12px;
    flex-shrink: 0;
}
.app-shell.is-collapsed .sidebar { display: none; }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 12px;
    border-radius: 8px;
    color: #5b6478;
    position: relative;
    border: 0;
    background: none;
    width: 100%;
    text-align: left;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item.is-active { color: var(--navy); font-weight: 700; background: #dce6f2; }
.nav-item.is-active::before {
    content: "";
    position: absolute;
    left: -12px;
    top: 8px;
    bottom: 8px;
    width: 4px;
    background: var(--navy);
    border-radius: 0 4px 4px 0;
}
.nav-item.is-disabled { opacity: .55; cursor: not-allowed; }
.nav-item .chev { margin-left: auto; font-size: 12px; color: var(--muted); }
.team-list { list-style: none; margin: 0 0 8px 34px; padding: 0; color: #6b7386; font-size: 13px; line-height: 1.35; }
.team-list li { padding: 5px 0; }
.team-list a { display: block; }
.team-toggle:not(.is-open) + .team-list { display: none; }
.team-toggle.is-open .chev { transform: rotate(180deg); }

.app-main {
    flex: 1;
    min-width: 0;
    background: #e8edf4;
    border-radius: 0;
    padding: 22px 24px 28px;
}

.drop-wrap { position: relative; }
.dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    background: #fff;
    box-shadow: var(--shadow);
    border-radius: 10px;
    min-width: 220px;
    z-index: 20;
    color: var(--text);
}
.user-dropdown { padding: 8px; min-width: 180px; }
.user-dropdown a,
.user-dropdown button {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; border-radius: 8px; color: #444;
    width: 100%; text-align: left; background: none; border: 0; font: inherit; cursor: pointer;
}
.user-dropdown a:hover,
.user-dropdown button:hover { background: #f5f7fb; }

.notif-dropdown { width: 340px; overflow: hidden; padding: 0; }
.notif-head {
    background: var(--navy);
    color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    font-size: 14px;
    flex-wrap: wrap;
}
.notif-head-actions { display: flex; gap: 12px; flex-shrink: 0; margin-left: auto; }
.notif-head .link-btn { color: #fff; text-decoration: underline; }
.notif-item { display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.notif-item strong, .notif-item small, .notif-item em { display: block; }
.notif-item small { color: var(--muted); font-size: 13px; margin-top: 2px; }
.notif-item em { color: var(--muted); font-size: 12px; font-style: normal; margin-top: 6px; }
.dot-ico {
    width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; color: #fff;
}
.dot-ico.red { background: #e45b5b; }
.dot-ico.cyan { background: #4ec6e8; }
.dot-ico.blue { background: #4d7cff; }
.dot-ico.purple { background: var(--purple); }
.dot-ico.green { background: #3dcf8e; }

.flash { padding: 10px 12px; border-radius: 8px; margin-bottom: 14px; }
.flash-ok { background: #e9f9ef; color: #1e7a46; }
.flash-err { background: #fdecec; color: #b42318; }

.page-kicker { margin: 0 0 10px; color: var(--navy); font-weight: 700; }
.status-select { border: 1px solid #d9e0ea; border-radius: 6px; padding: 6px 8px; background: #fff; min-width: 130px; }
.page-actions { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.btn { border: 0; border-radius: 6px; padding: 10px 16px; color: #fff; font-weight: 600; display: inline-flex; align-items: center; gap: 8px; }
.btn-blue { background: var(--blue); }
.btn-gold { background: var(--gold); color: #2d2a1e; }
.btn-orange { background: var(--orange); color: #fff; }
.btn-gray { background: #8d95a8; color: #fff; }
.btn-outline {
    background: #fff;
    color: #1e2430;
    border: 1px solid #c5cdd8;
}
.btn-outline:hover { background: #f4f6f9; }
.card { background: #fff; border-radius: 10px; box-shadow: var(--shadow); padding: 18px 20px; }
.card h2 { margin: 0 0 14px; font-size: 16px; color: #334155; }
.chart-panel { margin-bottom: 16px; }
.chart-layout { display: flex; align-items: center; gap: 28px; flex-wrap: wrap; }
.chart-wrap { position: relative; width: 240px; height: 240px; flex-shrink: 0; }
.legend { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px 24px; min-width: 280px; }
.legend li { display: flex; align-items: center; gap: 8px; color: #4b5568; font-size: 14px; }
.legend span { color: #64748b; }
.legend i, .chart-legend i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.c-pendiente { background: #3b82f6; }
.c-ejecucion { background: #f59e0b; }
.c-completada { background: #22c55e; }
.c-revision { background: #a855f7; }
.c-finalizada { background: #94a3b8; }

.table-wrap { overflow-x: auto; }
.tasks-table { width: 100%; border-collapse: collapse; }
.tasks-table th {
    text-align: left; font-size: 13px; color: #64748b; font-weight: 700;
    padding: 10px 8px; border-bottom: 1px solid var(--line);
}
.tasks-table td { padding: 12px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tasks-table td strong, .tasks-table td small { display: block; }
.tasks-table td small.feedback-note { color: #c2410c; font-weight: 600; }
.assign-select {
    border: 1px solid #d9e0ea; border-radius: 8px; padding: 7px 10px; background: #fff; min-width: 140px;
}
.status-pct { font-weight: 700; }
.status-pct.ejecucion { color: #e87a22; }
.status-pct.completada { color: #16a34a; }
.status-pct.revision { color: #7c3aed; }
.status-badge {
    display: inline-block; background: var(--orange); color: #fff;
    border-radius: 6px; padding: 6px 10px; font-size: 12px; font-weight: 700;
}
.pct-track {
    position: relative;
    height: 22px;
    min-width: 88px;
    background: #e8edf4;
    border-radius: 4px;
    overflow: hidden;
}
.pct-fill { display: block; height: 100%; }
.pct-track.ejecucion .pct-fill { background: var(--orange); }
.pct-track.completada .pct-fill { background: #22c55e; }
.pct-track.revision .pct-fill { background: #a855f7; }
.pct-track.finalizada .pct-fill { background: #94a3b8; }
.pct-track.pendiente .pct-fill { background: var(--orange); }
.pct-track em {
    position: absolute; inset: 0;
    display: grid; place-items: center;
    font-size: 11px; font-style: normal; font-weight: 700; color: #fff;
    text-shadow: 0 1px 1px rgba(0,0,0,.25);
}

/* Drawer */
.drawer {
    position: fixed; top: 0; right: 0; width: min(380px, 92vw); height: 100vh;
    background: #fff; box-shadow: -12px 0 40px rgba(30,40,70,.12); z-index: 30;
    padding: 12px 18px 24px; overflow: auto;
}
.drawer-head { display: flex; align-items: center; gap: 8px; }
.tabs { display: flex; gap: 24px; margin: 8px auto 0; }
.tab { background: none; border: 0; padding: 10px 0; color: #8b93a7; position: relative; }
.tab.is-active { color: var(--blue); font-weight: 700; }
.tab.is-active::after {
    content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--blue); border-radius: 3px;
}
.timeline { list-style: none; margin: 24px 0 0; padding: 0 0 0 18px; border-left: 2px solid #ece9ff; }
.timeline li { position: relative; padding: 0 0 22px 18px; }
.tl-ico {
    position: absolute; left: -29px; top: 0; width: 28px; height: 28px; border-radius: 50%;
}
.tl-ico.blue { background: #4d7cff; }
.tl-ico.green { background: #3dcf8e; }
.tl-ico.gold { background: #f0b429; }
.timeline strong { display: block; }
.timeline small { color: var(--muted); }
.timeline p { color: #6b7386; font-size: 13px; margin: 6px 0 0; }
.setting { display: flex; justify-content: space-between; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.setting p { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.switch { position: relative; width: 44px; height: 24px; flex-shrink: 0; }
.switch input { display: none; }
.switch span { position: absolute; inset: 0; background: #d7dbe6; border-radius: 99px; transition: .2s; }
.switch span::after {
    content: ""; position: absolute; width: 18px; height: 18px; background: #fff; border-radius: 50%;
    top: 3px; left: 3px; transition: .2s;
}
.switch input:checked + span { background: var(--green); }
.switch input:checked + span::after { transform: translateX(20px); }

/* Modal */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(12, 28, 52, .45);
    display: grid; place-items: center; z-index: 40; padding: 16px;
}
.modal {
    background: #fff; width: min(520px, 100%); border-radius: 8px; padding: 0;
    box-shadow: 0 18px 50px rgba(12, 28, 52, .28);
    overflow: hidden;
    max-height: min(640px, calc(100dvh - 24px));
    display: flex;
    flex-direction: column;
}
.modal-head {
    display: flex; justify-content: space-between; align-items: center;
    margin: 0; padding: 12px 16px; background: var(--navy); color: #fff;
    flex-shrink: 0; gap: 8px;
}
.modal-head h3 { margin: 0; font-size: 16px; font-weight: 700; line-height: 1.3; }
.modal-head .icon-btn { color: #fff; flex-shrink: 0; }
.modal-head .icon-btn:hover { background: rgba(255,255,255,.12); }
.modal > form, .modal-body { padding: 16px 20px 18px; overflow-y: auto; }
.modal > .hint,
.modal > p,
.modal > label,
.modal > .modal-actions {
    margin-left: 20px;
    margin-right: 20px;
}
.modal > .modal-actions { margin-bottom: 16px; }
.modal label { display: block; margin: 10px 0 6px; color: #334155; font-size: 14px; font-weight: 600; }
.modal input, .modal select, .modal textarea {
    width: 100%; border: 1px solid #cfd6e0; border-radius: 6px; padding: 10px 12px; background: #fff;
}
.modal-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal-actions { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
.prio-field { position: relative; }
.prio-field .sq {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    z-index: 1;
}
.prio-native,
.modal select.prio-native {
    width: 100%;
    border: 1px solid #cfd6e0;
    border-radius: 6px;
    padding: 10px 12px 10px 34px;
    background: #fff;
    color: var(--text);
    appearance: auto;
}
.sq {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    display: inline-block;
    flex-shrink: 0;
}
.sq.critico { background: #e45b5b; }
.sq.urgente { background: #e87a22; }
.sq.importante { background: #eab308; }
.sq.normal { background: #22c55e; }
.hint { color: var(--muted); font-size: 13px; }
.muted { color: var(--muted); }

.plan-toolbar { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 8px; }
.plan-toolbar h2 { margin: 0; }
.week-nav { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.btn-ghost { background: #fff; color: #0e4d8c; border: 0; border-radius: 10px; padding: 8px 12px; font-weight: 600; }
.btn.btn-ghost { background: #fff; color: #0e4d8c; }
.plan-hint { margin: 0 0 14px; }
.week-board { display: grid; grid-template-columns: 180px repeat(6, minmax(140px, 1fr)); gap: 8px; overflow-x: auto; }
.day-col {
    background: #fff; border-radius: 14px; min-height: 460px; padding: 10px;
    box-shadow: var(--shadow);
}
.day-col.pool { background: #eef4fb; }
.day-col.is-today { box-shadow: 0 0 0 2px #f97316, var(--shadow); }
.day-col header { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; font-weight: 700; color: #0e4d8c; }
.day-col header small, .day-col header em { margin-left: auto; font-size: 11px; font-style: normal; color: #f97316; }
.day-col.pool header small { color: #64748b; }
.add-day {
    margin-left: auto; width: 24px; height: 24px; border: 0; border-radius: 6px;
    background: var(--blue); color: #fff; font-weight: 700; line-height: 1;
}
.plan-card {
    background: #fff; border-radius: 10px; padding: 8px 10px; margin-bottom: 8px;
    border-left: 4px solid #94a3b8; cursor: grab; box-shadow: 0 2px 8px rgba(15,40,80,.06);
}
.day-col.pool .plan-card { background: #fff; }
.plan-card.prio-critico { border-left-color: #ef4444; }
.plan-card.prio-urgente { border-left-color: #f97316; }
.plan-card.prio-importante { border-left-color: #2563eb; }
.plan-card.prio-normal { border-left-color: #94a3b8; }
.plan-card strong, .plan-card small { display: block; }
.plan-card small { color: var(--muted); margin: 4px 0; }
.plan-card .prio { font-size: 11px; font-weight: 700; }
.prio.critico { color: #ef4444; }
.prio.urgente { color: #e87a22; }
.prio.importante { color: #ca8a04; }
.prio.normal { color: #16a34a; }
.mini { font-size: 12px; }
.day-col.is-over { background: #fff7ed; }

.team-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.member-card {
    background: #fff; border-radius: 16px; padding: 18px; box-shadow: var(--shadow);
    display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
}
.member-card:hover { transform: translateY(-2px); }
.avatar.lg { width: 52px; height: 52px; font-size: 18px; margin-bottom: 8px; color: #0a3a72; }
.member-card strong { font-size: 16px; }
.member-card small { color: var(--muted); }
.member-stats { list-style: none; display: flex; gap: 12px; padding: 12px 0 0; margin: 8px 0 0; border-top: 1px solid var(--line); width: 100%; color: #64748b; font-size: 12px; }
.member-stats b { color: #0e4d8c; display: block; font-size: 16px; }
.assign-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.assign-form select { border: 1px solid #d9e0ea; border-radius: 8px; padding: 8px 10px; min-width: 240px; }
.filters { display: flex; gap: 12px; flex-wrap: wrap; align-items: end; margin-bottom: 16px; background: #fff; padding: 14px; border-radius: 14px; box-shadow: var(--shadow); }
.filters label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: #64748b; }
.filters select { border: 1px solid #d9e0ea; border-radius: 8px; padding: 8px 10px; min-width: 150px; color: var(--text); }
.phase { display: inline-block; border-radius: 99px; padding: 4px 10px; font-size: 12px; font-weight: 700; }
.phase.pendiente { background: #dbeafe; color: #1d4ed8; }
.phase.ejecucion { background: #ffedd5; color: #c2410c; }
.phase.completada { background: #dcfce7; color: #15803d; }
.phase.revision { background: #f3e8ff; color: #7e22ce; }
.phase.finalizada { background: #e2e8f0; color: #475569; }
.g-row { cursor: pointer; }
.g-row:hover { background: #f8fafc; }
.g-detail td { background: #f8fafc; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 20px; padding: 8px 4px; }
.detail-grid p { margin: 0; color: #475569; font-size: 14px; }
.detail-grid label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: #64748b; }

.notif-item.is-unread { background: #fff7ed; }
.notif-item.is-unread strong { color: #c2410c; }

.alarm-banner {
    position: fixed;
    left: 50%;
    bottom: 22px;
    transform: translateX(-50%);
    z-index: 50;
    display: flex;
    align-items: center;
    gap: 16px;
    background: #9a1b1b;
    color: #fff;
    padding: 14px 18px;
    border-radius: 14px;
    box-shadow: 0 12px 30px rgba(154, 27, 27, .35);
    min-width: min(520px, 92vw);
}
.alarm-banner[hidden] { display: none !important; }
.alarm-banner strong { display: block; font-size: 14px; }
.alarm-banner span { font-size: 13px; opacity: .92; }

.smtp-card { margin-bottom: 16px; max-width: 860px; }
.smtp-card h2 { margin-bottom: 8px; }
.crumb { margin: 0 0 12px; color: #94a3b8; font-size: 13px; }
.smtp-panel {
    background: #fff;
    border-radius: 16px;
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 16px;
    max-width: 860px;
}
.smtp-panel-head {
    background: var(--navy);
    color: #fff;
    font-weight: 700;
    padding: 12px 18px;
}
.smtp-panel-body { padding: 18px 20px 20px; }
.smtp-enable-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    color: #334155;
}
.port-row { display: flex; gap: 8px; }
.port-row select { flex: 1; }
.port-row input { width: 120px; }
.smtp-panel-body select,
.smtp-card select {
    border: 1px solid #d9e0ea;
    border-radius: 8px;
    padding: 10px 12px;
    background: #fff;
    color: var(--text);
}
.smtp-toggle { margin: 12px 0 16px; font-weight: 600; color: #334155; }
.smtp-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 16px;
    margin-bottom: 16px;
}
.smtp-grid label, .smtp-card > label:not(.check), .smtp-panel-body > label:not(.check) {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
    color: #64748b;
}
.smtp-grid input, .smtp-grid select { width: 100%; }
.smtp-card input[type=text],
.smtp-card input[type=email],
.smtp-card input[type=password],
.smtp-card input[type=number],
.smtp-panel-body input[type=text],
.smtp-panel-body input[type=email],
.smtp-panel-body input[type=password],
.smtp-panel-body input[type=number] {
    border: 1px solid #d9e0ea;
    border-radius: 8px;
    padding: 10px 12px;
    color: var(--text);
}
.smtp-card input[readonly] { background: #f1f5f9; color: #475569; }
.backup-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.backup-actions form { margin: 0; }
.btn-danger { background: #b91c1c; color: #fff; }
.danger-panel .smtp-panel-head { background: #b91c1c; }

.status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 14px;
    margin-top: 16px;
}
.status-card {
    background: #fff;
    border-radius: 10px;
    box-shadow: var(--shadow);
    padding: 16px 18px 18px;
    border-top: 4px solid #94a3b8;
}
.status-card.tone-ok { border-top-color: #16a34a; }
.status-card.tone-warn { border-top-color: #e87a22; }
.status-card.tone-down { border-top-color: #dc2626; }
.status-card header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}
.status-card h3 { margin: 0; font-size: 15px; color: #334155; }
.status-pill {
    font-size: 12px;
    font-weight: 700;
    border-radius: 99px;
    padding: 4px 10px;
    background: #e2e8f0;
    color: #475569;
}
.tone-ok .status-pill { background: #dcfce7; color: #15803d; }
.tone-warn .status-pill { background: #ffedd5; color: #c2410c; }
.tone-down .status-pill { background: #fee2e2; color: #b91c1c; }
.status-meter {
    height: 10px;
    background: #e8edf4;
    border-radius: 99px;
    overflow: hidden;
    margin-bottom: 10px;
}
.status-meter span { display: block; height: 100%; background: var(--navy); border-radius: 99px; }
.tone-ok .status-meter span { background: #16a34a; }
.tone-warn .status-meter span { background: #e87a22; }
.tone-down .status-meter span { background: #dc2626; }
.status-card p { margin: 0; color: #475569; font-size: 13px; line-height: 1.45; }
.ssl-renew { margin-top: 12px; }

.history-hint { margin: 0 0 14px; }
.table-card h2 small {
    display: inline-block;
    margin-left: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
}
.history-list { display: flex; flex-direction: column; }
.history-item {
    display: flex;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px solid var(--line);
}
.history-item:last-child { border-bottom: 0; }
.history-item strong, .history-item small, .history-item em { display: block; }
.history-item small { color: var(--muted); font-size: 13px; margin-top: 4px; }
.history-item em { color: var(--muted); font-size: 12px; font-style: normal; margin-top: 6px; }

@media (max-width: 980px) {
    .app-row { flex-direction: column; }
    .sidebar { width: 100%; border-radius: 0; border-right: 0; }
    .app-main { border-radius: 0; padding: 14px 12px 20px; }
    .modal-row { grid-template-columns: 1fr; }
    .legend { grid-template-columns: 1fr; }
    .week-board { grid-template-columns: 1fr 1fr; }
    .smtp-grid { grid-template-columns: 1fr; }
    .topbar { height: 62px; padding: 0 12px; }
    .brand-logo img { height: 40px; max-width: min(210px, 48vw); object-fit: contain; }
    .user-copy { display: none; }
    .chart-wrap { width: 180px; height: 180px; }
    .page-actions .btn { flex: 1 1 100%; justify-content: center; }
}
@media (max-width: 640px) {
    .modal-overlay { padding: 0; align-items: stretch; }
    .modal {
        width: 100%;
        max-height: 100dvh;
        min-height: 100dvh;
        border-radius: 0;
    }
    .modal-actions {
        flex-direction: column;
        align-items: stretch;
    }
    .modal-actions .btn { width: 100%; justify-content: center; }
    .week-board { grid-template-columns: 1fr; }
    .filters { flex-direction: column; align-items: stretch; }
    .filters select { min-width: 0; width: 100%; }
    .assign-form select { min-width: 0; width: 100%; }
    .tasks-table { font-size: 13px; }
    .login-card { width: 100%; min-height: 100dvh; border-radius: 0; }
}
