/* Shared design system for the Email Service pages (dashboard, admin panel, API docs) */

:root {
    --bg: #f4f6fa;
    --surface: #ffffff;
    --surface-2: #f8f9fc;
    --border: #e4e8ef;
    --border-soft: #eef1f5;
    --text: #121829;
    --text-2: #475069;
    --muted: #8790a5;
    --primary: #0a7fb0;
    --primary-hover: #086b95;
    --primary-soft: #e7f5fb;
    --ring: rgba(10, 127, 176, .18);
    --success: #18935a;
    --success-soft: #e9f8f0;
    --warning: #b76e00;
    --warning-soft: #fff6e0;
    --danger: #d92d2d;
    --danger-hover: #b92424;
    --danger-soft: #fdeeee;
    --violet: #6d2f94;
    --violet-soft: #f5effa;
    --side-bg: #0f172a;
    --brand-grad: linear-gradient(135deg, #0aa8dc 0%, #2bb5a8 55%, #26a96c 100%);
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
    --shadow-md: 0 4px 16px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .05);
    --radius: 14px;
    --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, 'Courier New', monospace;
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* ── App shell ── */
.app {
    display: flex;
    min-height: 100vh;
}

.main-col {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

/* ── Sidebar ── */
.sidebar {
    width: 252px;
    flex-shrink: 0;
    background: var(--side-bg);
    color: #c9d1e3;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 20px 14px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 8px 20px;
    margin-bottom: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, .07);
    text-decoration: none;
}

.logo-img {
    height: 30px;
    width: auto;
    display: block;
}

.brand-name {
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    letter-spacing: -.2px;
}

.brand-sub {
    font-size: 11.5px;
    color: #7f8aa3;
    margin-top: 1px;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    margin: 0 -14px;
    padding: 0 14px;
}

.nav-label {
    font-size: 10.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .8px;
    color: #5f6b85;
    padding: 0 10px 8px;
}

.nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 11px;
    width: 100%;
    padding: 9px 10px;
    border-radius: 9px;
    border: none;
    background: none;
    color: #aab3c7;
    font: 500 13.5px 'Inter', sans-serif;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    position: relative;
    transition: background .15s, color .15s;
}

.nav-item svg {
    flex-shrink: 0;
    opacity: .75;
}

.nav-item:hover {
    background: rgba(255, 255, 255, .05);
    color: #fff;
}

.nav-item.current {
    color: #fff;
    font-weight: 600;
}

.nav-item.current svg,
.nav-item.active svg {
    opacity: 1;
    color: #38c3e8;
}

.nav-item.active {
    background: rgba(255, 255, 255, .09);
    color: #fff;
}

.nav>.nav-item.active::before {
    content: '';
    position: absolute;
    left: -14px;
    top: 8px;
    bottom: 8px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--brand-grad);
}

.nav-sub {
    display: flex;
    flex-direction: column;
    gap: 1px;
    margin: 2px 0 8px 18px;
    padding-left: 10px;
    border-left: 1px solid rgba(255, 255, 255, .09);
}

.nav-sub .nav-item {
    gap: 9px;
    padding: 7px 10px;
    font-size: 13px;
}

.nav-sub .nav-item.active::before {
    content: '';
    position: absolute;
    left: -11px;
    top: 7px;
    bottom: 7px;
    width: 2px;
    border-radius: 2px;
    background: var(--brand-grad);
}

.nav-count {
    margin-left: auto;
    font-size: 11px;
    font-weight: 600;
    padding: 1px 8px;
    border-radius: 10px;
    background: rgba(255, 255, 255, .08);
    color: #c9d1e3;
}

.nav-count:empty {
    display: none;
}

/* ── Top bar ── */
.topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    background: rgba(255, 255, 255, .88);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    padding: 16px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.page-title {
    min-width: 0;
}

.page-title h1 {
    font-size: 19px;
    font-weight: 700;
    letter-spacing: -.3px;
}

.page-title p {
    font-size: 13px;
    color: var(--muted);
    margin-top: 2px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.conn-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    background: var(--surface-2);
    color: var(--text-2);
    border: 1px solid var(--border);
    transition: all .2s;
}

.conn-pill .dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #a3abbd;
}

.conn-pill.connected {
    background: var(--success-soft);
    color: var(--success);
    border-color: #c4ebd6;
}

.conn-pill.connected .dot {
    background: var(--success);
    box-shadow: 0 0 0 3px rgba(24, 147, 90, .18);
}

.conn-pill.connecting .dot {
    background: #e0a100;
    animation: pulse 1s ease-in-out infinite;
}

.conn-pill.disconnected {
    background: var(--danger-soft);
    color: var(--danger);
    border-color: #f7caca;
}

.conn-pill.disconnected .dot {
    background: var(--danger);
}

/* ── Connection settings panel ── */
.config-panel {
    display: none;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 18px 32px;
}

.config-panel.open {
    display: block;
    animation: fadeDown .18s ease;
}

.config-form {
    display: flex;
    gap: 14px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.config-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.config-field label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-2);
}

.config-field .input {
    width: 260px;
}

.config-note {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
    font-size: 12px;
    color: var(--muted);
}

.input-wrap {
    position: relative;
}

.input-wrap .input {
    padding-right: 38px;
}

.input-wrap .mini-btn {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
}

/* ── Inputs ── */
.input,
.form-group input,
.form-group select,
.form-group textarea {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 8px 12px;
    border-radius: 9px;
    font: 400 13px 'Inter', sans-serif;
    outline: none;
    box-shadow: var(--shadow-sm);
    transition: border-color .15s, box-shadow .15s;
}

.input:focus,
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--ring);
}

.input::placeholder,
.form-group input::placeholder,
.form-group textarea::placeholder {
    color: #a8b0c0;
}

select.input,
.form-group select {
    appearance: none;
    cursor: pointer;
    padding-right: 32px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238790a5' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}

.search {
    position: relative;
    display: flex;
    align-items: center;
}

.search svg {
    position: absolute;
    left: 11px;
    color: var(--muted);
    pointer-events: none;
}

.search .input {
    padding-left: 34px;
    width: 240px;
}

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 8px 15px;
    border-radius: 9px;
    border: 1px solid transparent;
    font: 600 13px 'Inter', sans-serif;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
    transition: background .15s, border-color .15s, color .15s, box-shadow .15s, transform .05s;
}

.btn:active:not(:disabled) {
    transform: translateY(1px);
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 1px 2px rgba(10, 127, 176, .3);
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
    box-shadow: 0 3px 10px rgba(10, 127, 176, .28);
}

.btn-success {
    background: var(--success);
    color: #fff;
}

.btn-success:hover:not(:disabled) {
    background: #137a4a;
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-danger:hover:not(:disabled) {
    background: var(--danger-hover);
}

.btn-ghost {
    background: var(--surface);
    color: var(--text-2);
    border-color: var(--border);
    box-shadow: var(--shadow-sm);
}

.btn-ghost:hover:not(:disabled) {
    background: var(--surface-2);
    border-color: #d3d9e3;
    color: var(--text);
}

.btn-ghost.active {
    background: var(--primary-soft);
    border-color: #b9e1f1;
    color: var(--primary);
}

.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
    border-radius: 8px;
}

.btn-icon {
    padding: 0;
    width: 36px;
    height: 36px;
}

.btn:disabled {
    opacity: .45;
    cursor: not-allowed;
}

.btn .btn-spin {
    display: none;
}

.btn.loading {
    pointer-events: none;
}

.btn.loading .btn-spin {
    display: inline-block;
}

.btn.loading .btn-ico {
    display: none;
}

.btn-primary .spinner,
.btn-danger .spinner,
.btn-success .spinner {
    border-color: rgba(255, 255, 255, .35);
    border-top-color: #fff;
}

.mini-btn {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    border: none;
    background: none;
    color: var(--muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background .15s, color .15s;
}

.mini-btn:hover {
    background: #eef1f6;
    color: var(--text);
}

/* ── Segmented control ── */
.seg {
    display: inline-flex;
    gap: 2px;
    padding: 3px;
    border-radius: 9px;
    background: #eef1f5;
}

.seg button {
    border: none;
    background: none;
    padding: 5px 12px;
    border-radius: 7px;
    font: 600 12px 'Inter', sans-serif;
    color: var(--muted);
    cursor: pointer;
    transition: background .15s, color .15s;
}

.seg button:hover {
    color: var(--text);
}

.seg button.active {
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow-sm);
}

/* ── Main ── */
main {
    padding: 28px 32px 40px;
}

.panel {
    display: none;
}

.panel.active {
    display: block;
    animation: fadeIn .2s ease;
}

/* ── Section card ── */
.section-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.toolbar {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-soft);
}

.toolbar-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 12px 18px;
    border-top: 1px solid var(--border-soft);
    background: var(--surface-2);
}

.page-info {
    font-size: 12.5px;
    color: var(--muted);
    font-weight: 500;
}

.pager {
    display: flex;
    align-items: center;
    gap: 8px;
}

.page-num {
    min-width: 48px;
    text-align: center;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-2);
}

/* ── Table ── */
.table-wrap {
    overflow-x: auto;
}

.table-wrap table {
    width: 100%;
    min-width: 760px;
    border-collapse: collapse;
    font-size: 13px;
}

.table-wrap thead th {
    background: var(--surface-2);
    padding: 10px 16px;
    text-align: left;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: .6px;
    border-bottom: 1px solid var(--border-soft);
    white-space: nowrap;
}

.table-wrap tbody tr {
    border-bottom: 1px solid var(--border-soft);
    transition: background .12s;
}

.table-wrap tbody tr:last-child {
    border-bottom: none;
}

.table-wrap tbody tr:hover {
    background: #f6fafd;
}

.table-wrap tbody tr.static:hover {
    background: none;
}

.table-wrap tbody td {
    padding: 12px 16px;
    vertical-align: middle;
    color: var(--text-2);
}

td.actions {
    width: 1%;
    white-space: nowrap;
}

.row-actions {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
    opacity: .6;
    transition: opacity .15s;
}

tr:hover .row-actions,
.row-actions:focus-within {
    opacity: 1;
}

/* ── Cell content ── */
.truncate {
    display: block;
    max-width: 240px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.id-cell {
    font: 600 12px var(--mono);
    color: var(--violet);
    background: var(--violet-soft);
    padding: 2px 7px;
    border-radius: 6px;
    white-space: nowrap;
}

.mono {
    font-family: var(--mono);
    font-size: 12px;
}

.muted {
    color: #b3bac8;
}

.strong {
    color: var(--text);
    font-weight: 600;
}

.cell-main {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.avatar {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11.5px;
    font-weight: 700;
    background: hsl(var(--h), 70%, 93%);
    color: hsl(var(--h), 50%, 32%);
}

.cell-title {
    color: var(--text);
    font-weight: 600;
}

.cell-sub {
    font-size: 12px;
    color: var(--muted);
    margin-top: 1px;
}

.link {
    color: var(--primary);
    text-decoration: none;
}

.link:hover {
    text-decoration: underline;
}

.date {
    font-size: 12.5px;
    color: var(--muted);
    white-space: nowrap;
}

.preview {
    max-width: 420px;
    color: var(--muted);
}

.chip {
    font: 500 12px var(--mono);
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-2);
    padding: 3px 8px;
    border-radius: 6px;
    cursor: copy;
    transition: border-color .15s, color .15s;
}

.chip:hover {
    border-color: #9fd3ea;
    color: var(--primary);
}

.secret {
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

.secret-val {
    min-width: 76px;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-right: 4px;
    color: var(--text-2);
}

/* ── Badges ── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px 3px 8px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 600;
    text-transform: capitalize;
    white-space: nowrap;
    border: 1px solid transparent;
    background: #f2f4f7;
    color: #667085;
}

.badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.badge.plain {
    padding: 3px 9px;
}

.badge.plain::before {
    display: none;
}

.badge-active,
.badge-success {
    background: var(--success-soft);
    color: var(--success);
    border-color: #c9eedb;
}

.badge-inactive {
    background: #f2f4f7;
    color: #667085;
    border-color: var(--border);
}

.badge-pending {
    background: var(--warning-soft);
    color: var(--warning);
    border-color: #fbe2a8;
}

.badge-processing {
    background: var(--violet-soft);
    color: var(--violet);
    border-color: #e6d5f2;
}

.badge-failed {
    background: var(--danger-soft);
    color: var(--danger);
    border-color: #f7caca;
}

.badge-direct {
    background: var(--primary-soft);
    color: var(--primary);
    border-color: #c5e6f3;
}

.badge-scheduled {
    background: #eaf8f3;
    color: #157f6b;
    border-color: #c4ebdf;
}

/* ── Icon buttons ── */
.icon-btn {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
    transition: all .15s;
}

.edit-btn,
.view-btn {
    color: var(--primary);
}

.edit-btn:hover,
.view-btn:hover {
    background: var(--primary-soft);
    border-color: #b9e1f1;
}

.retry-btn {
    color: var(--warning);
}

.retry-btn:hover {
    background: var(--warning-soft);
    border-color: #fbe2a8;
}

.delete-btn {
    color: var(--danger);
}

.delete-btn:hover {
    background: var(--danger-soft);
    border-color: #f7caca;
}

/* ── Loading / empty states ── */
.skel {
    height: 10px;
    border-radius: 6px;
    background: linear-gradient(90deg, #eef1f5 25%, #f7f8fb 50%, #eef1f5 75%);
    background-size: 200% 100%;
    animation: shimmer 1.2s linear infinite;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 56px 20px;
    text-align: center;
}

.empty-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: var(--primary-soft);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
}

.empty-state.error .empty-icon {
    background: var(--danger-soft);
    color: var(--danger);
}

.empty-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.empty-text {
    font-size: 13px;
    color: var(--muted);
    max-width: 360px;
}

.empty-state .btn {
    margin-top: 12px;
}

.spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin .6s linear infinite;
    vertical-align: middle;
}

/* ── Code blocks ── */
.code-block {
    position: relative;
    background: #0f172a;
    border: 1px solid #1e293b;
    border-radius: 10px;
    padding: 14px 16px;
}

.code-block pre {
    font: 12.5px/1.65 var(--mono);
    color: #e2e8f0;
    white-space: pre-wrap;
    word-break: break-word;
    padding-right: 72px;
}

.copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 9px;
    border-radius: 6px;
    background: rgba(255, 255, 255, .08);
    border: 1px solid rgba(255, 255, 255, .12);
    color: #cbd5e1;
    font: 500 11px 'Inter', sans-serif;
    cursor: pointer;
    transition: background .15s, color .15s;
}

.copy-btn:hover {
    background: rgba(255, 255, 255, .15);
    color: #fff;
}

/* ── Overlay / modal ── */
.overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 100;
    padding: 16px;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, .5);
    backdrop-filter: blur(3px);
}

.overlay.open {
    display: flex;
    animation: fadeIn .15s ease;
}

.modal {
    background: var(--surface);
    border-radius: 16px;
    width: 640px;
    max-width: 100%;
    max-height: calc(100vh - 32px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 64px rgba(15, 23, 42, .22), 0 4px 16px rgba(15, 23, 42, .08);
    animation: pop .18s ease;
}

.modal-sm {
    width: 420px;
}

.modal-lg {
    width: 800px;
}

.modal-header {
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--border-soft);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.modal-header h2 {
    font-size: 16px;
    font-weight: 700;
}

.modal-sub {
    font-size: 12.5px;
    color: var(--muted);
    margin-top: 3px;
}

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    background: none;
    color: var(--muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background .15s, color .15s;
}

.modal-close:hover {
    background: var(--surface-2);
    color: var(--text);
}

.modal-body {
    padding: 20px 24px 4px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 14px 24px;
    border-top: 1px solid var(--border-soft);
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    align-items: center;
    background: var(--surface-2);
}

.kbd-hint {
    margin-right: auto;
    font-size: 11.5px;
    color: var(--muted);
}

kbd {
    font: 600 10.5px var(--mono);
    background: var(--surface);
    border: 1px solid var(--border);
    border-bottom-width: 2px;
    border-radius: 4px;
    padding: 1px 5px;
}

.confirm-body {
    display: flex;
    gap: 16px;
    padding: 24px;
}

.confirm-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--danger-soft);
    color: var(--danger);
}

.confirm-body h3 {
    font-size: 15.5px;
    font-weight: 700;
    margin-bottom: 6px;
}

.confirm-body p {
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-2);
}

/* ── Forms ── */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 16px;
}

.form-group {
    margin-bottom: 16px;
    min-width: 0;
}

.form-group.full {
    grid-column: 1 / -1;
}

.form-group label {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-2);
    margin-bottom: 6px;
}

.form-group .hint {
    font-size: 11.5px;
    color: var(--muted);
    margin-top: 5px;
}

.req {
    color: var(--danger);
    margin-left: 2px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 9px 12px;
}

.form-group select {
    padding-right: 32px;
}

.form-group textarea {
    resize: vertical;
    min-height: 150px;
    font-family: var(--mono);
    font-size: 12.5px;
    line-height: 1.55;
}

.form-group input:disabled {
    background: var(--surface-2);
    color: var(--muted);
    cursor: not-allowed;
}

/* ── Toast ── */
#toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 999;
    display: none;
    align-items: center;
    gap: 10px;
    max-width: 360px;
    padding: 12px 16px;
    border-radius: 12px;
    background: var(--side-bg);
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    box-shadow: 0 12px 32px rgba(15, 23, 42, .25);
}

#toast.show {
    display: flex;
    animation: slideUp .2s ease;
}

.toast-icon {
    display: flex;
    flex-shrink: 0;
}

#toast.success .toast-icon {
    color: #4ade80;
}

#toast.error .toast-icon {
    color: #f87171;
}

/* ── Animations ── */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes shimmer {
    from {
        background-position: 200% 0;
    }

    to {
        background-position: -200% 0;
    }
}

@keyframes pulse {
    50% {
        opacity: .35;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
}

@keyframes fadeDown {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
}

@keyframes pop {
    from {
        opacity: 0;
        transform: translateY(8px) scale(.98);
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
}

/* ── Responsive ── */
@media (hover: none) {
    .row-actions {
        opacity: 1;
    }
}

@media (max-width: 900px) {
    .app {
        flex-direction: column;
    }

    .sidebar {
        position: static;
        width: 100%;
        height: auto;
        padding: 14px 16px 12px;
    }

    .brand {
        padding: 0 0 12px;
        margin: 0;
        border: none;
    }

    .sidebar-nav {
        overflow: visible;
    }

    .nav-label {
        display: none;
    }

    .nav {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 4px;
    }

    .nav-item {
        width: auto;
        white-space: nowrap;
        padding: 7px 10px;
        font-size: 13px;
    }

    .nav>.nav-item.active::before,
    .nav-sub .nav-item.active::before {
        display: none;
    }

    .nav-sub {
        order: 10;
        flex-basis: 100%;
        flex-direction: row;
        gap: 4px;
        overflow-x: auto;
        margin: 8px -16px 0;
        padding: 10px 16px 0;
        border-left: none;
        border-top: 1px solid rgba(255, 255, 255, .07);
    }

    .nav-sub .nav-item {
        flex-shrink: 0;
    }

    .topbar {
        position: static;
        padding: 14px 16px;
    }

    .page-title p {
        display: none;
    }

    .config-panel {
        padding: 16px;
    }

    .config-field,
    .config-field .input {
        width: 100%;
    }

    main {
        padding: 16px;
    }
}

@media (max-width: 600px) {
    .hide-sm {
        display: none;
    }

    .toolbar .search,
    .toolbar .search .input {
        width: 100%;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .kbd-hint {
        display: none;
    }

    #toast {
        left: 16px;
        right: 16px;
        bottom: 16px;
        max-width: none;
    }
}
