:root {
    --ink: #17202a;
    --muted: #667085;
    --line: #d9e0e8;
    --panel: #ffffff;
    --page: #f5f7fa;
    --nav: #101828;
    --nav-active: #2f6bff;
    --accent: #0f8b8d;
    --success: #147d48;
    --danger: #b42318;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--page);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
    color: #1f5eff;
    font-weight: 700;
    text-decoration: none;
}

input,
select,
textarea,
button {
    border-radius: 6px;
    font: inherit;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    padding: 10px 12px;
}

button {
    border: 0;
    cursor: pointer;
    font-weight: 800;
}

.login-body {
    display: grid;
    place-items: center;
    padding: 24px;
    background: linear-gradient(135deg, #101828 0%, #16313a 55%, #f4b942 55%, #f4b942 100%);
}

.login-shell {
    width: min(440px, 100%);
}

.login-panel,
.content-section,
.stat-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: 0 12px 30px rgba(16, 24, 40, .06);
}

.login-panel {
    padding: 32px;
}

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

.password-wrap input {
    width: 100%;
    padding-right: 44px;
}

.pwd-toggle {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: var(--muted);
    display: flex;
    align-items: center;
    font-weight: 400;
    transition: color 0.2s;
}

.pwd-toggle:hover {
    color: var(--ink);
}

.pwd-toggle svg {
    width: 18px;
    height: 18px;
    pointer-events: none;
}

.pwd-toggle .eye-off-icon {
    display: none;
}

.pwd-toggle.visible .eye-icon {
    display: none;
}

.pwd-toggle.visible .eye-off-icon {
    display: block;
}

.brand-mark {
    display: inline-grid;
    width: 44px;
    height: 44px;
    place-items: center;
    border-radius: 8px;
    background: #f4b942;
    color: #101828;
    font-weight: 900;
}

.login-panel h1,
.topbar h1,
.content-section h2,
.detail-grid h2 {
    margin: 8px 0;
    letter-spacing: 0;
}

.login-panel p,
.eyebrow,
.stat-card span,
td,
label {
    color: var(--muted);
}

.form-stack,
.notification-form {
    display: grid;
    gap: 16px;
}

label {
    display: grid;
    gap: 6px;
    font-size: 14px;
    font-weight: 700;
}

.primary-button,
.secondary-button {
    min-height: 42px;
    padding: 10px 16px;
}

.primary-button {
    background: var(--accent);
    color: #fff;
}

.secondary-button {
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
}

.action-btn, .danger-btn {
    border: 0;
    background: transparent;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
    font-family: inherit;
}

.action-btn {
    color: var(--muted);
}
.action-btn:hover {
    background: #f1f5f9;
    color: var(--ink);
}

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

.note-card {
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.note-card:hover {
    box-shadow: 0 4px 12px rgba(16, 24, 40, 0.08);
    transform: translateY(-1px);
}


.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 264px;
    background: var(--nav);
    color: #fff;
    padding: 22px 16px;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 28px;
    font-weight: 900;
}

.sidebar nav {
    display: grid;
    gap: 8px;
}

.nav-item {
    border-radius: 6px;
    color: #d0d5dd;
    padding: 12px 14px;
}

.nav-item.active,
.nav-item:hover {
    background: #23314a;
    color: #fff;
}

.logout-link {
    margin-top: 18px;
    color: #ffb4ab;
}

.app-main {
    margin-left: 264px;
    padding: 28px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 24px;
}

.eyebrow {
    margin: 0;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0;
    text-transform: uppercase;
}

.user-pill,
.status-pill {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    border-radius: 999px;
    background: #e7f8f4;
    color: #075e54;
    font-size: 12px;
    font-weight: 900;
    padding: 4px 10px;
    white-space: nowrap;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 18px;
}

.stat-card {
    padding: 20px;
}

.stat-card strong {
    display: block;
    margin-top: 8px;
    font-size: 28px;
    line-height: 1.1;
}

.content-section {
    margin-bottom: 18px;
    padding: 20px;
}

.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.section-heading h2 {
    font-size: 20px;
}

.toolbar,
.inline-form {
    display: grid;
    grid-template-columns: minmax(160px, 220px) minmax(180px, 1fr) auto;
    gap: 10px;
    margin-bottom: 16px;
}

.inline-form {
    grid-template-columns: minmax(180px, 1fr) auto;
    margin-bottom: 0;
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    min-width: 780px;
    border-collapse: collapse;
}

th,
td {
    border-bottom: 1px solid var(--line);
    padding: 13px 10px;
    text-align: left;
    vertical-align: top;
}

th {
    color: var(--ink);
    font-size: 12px;
    text-transform: uppercase;
}

.detail-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 420px);
    gap: 24px;
}

.notification-form {
    max-width: 760px;
}

.alert {
    border-radius: 6px;
    margin-bottom: 16px;
    padding: 12px 14px;
    font-weight: 800;
}

.alert-success {
    background: #ecfdf3;
    color: var(--success);
}

.alert-error {
    background: #fef3f2;
    color: var(--danger);
}

@media (max-width: 900px) {
    .sidebar {
        position: static;
        width: auto;
    }

    .app-main {
        margin-left: 0;
        padding: 18px;
    }

    .stats-grid,
    .detail-grid {
        grid-template-columns: 1fr;
    }

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

/* Pagination Styling */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--line);
    flex-wrap: wrap;
    gap: 15px;
}

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

.pagination-buttons {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.pagination-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    color: var(--ink);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
}

.pagination-btn:hover:not(.disabled) {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(15, 139, 141, 0.04);
    box-shadow: 0 2px 6px rgba(15, 139, 141, 0.08);
}

.pagination-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(15, 139, 141, 0.25);
}

.pagination-btn.disabled {
    opacity: 0.45;
    cursor: not-allowed;
    background: #f9fafb;
    border-color: var(--line);
    color: var(--muted);
    pointer-events: none;
}

@media (max-width: 640px) {
    .pagination {
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-align: center;
    }
}

/* Modal popup styles */
.modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(16, 24, 40, 0.45);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.modal-content {
    background-color: #ffffff;
    margin: 8% auto;
    padding: 24px;
    border: 1px solid var(--line);
    width: min(600px, 90%);
    border-radius: 12px;
    position: relative;
    box-shadow: 0 20px 40px rgba(16, 24, 40, 0.15);
    animation: modalSlide 0.2s ease-out;
}

@keyframes modalSlide {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.close-modal {
    position: absolute;
    right: 20px;
    top: 18px;
    font-size: 24px;
    font-weight: 500;
    cursor: pointer;
    color: var(--muted);
    transition: color 0.2s ease;
}

.close-modal:hover {
    color: var(--ink);
}

/* Spacer styles for channel sub-fields */
.channel-fields {
    display: grid;
    gap: 16px;
    margin-bottom: 8px;
}
