:root {
    --bg: #07111f;
    --panel: #0e1c31;
    --line: #1d3557;
    --text: #e8f1ff;
    --muted: #8aa0bf;
    --accent: #2ee6c7;
    --danger: #ff6b7a;
    --warn: #f5c542;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

.login-body {
    display: grid;
    place-items: center;
}
.login-card {
    width: 380px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 28px;
}
.login-card h1 { margin: 0 0 6px; }
label { display: block; margin: 12px 0; font-size: 14px; color: var(--muted); }
input, select, button {
    width: 100%;
    margin-top: 6px;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: #0a1628;
    color: var(--text);
}
button { cursor: pointer; }
.primary { background: var(--accent); color: #04221c; font-weight: 700; border: 0; }
.ghost { width: auto; background: transparent; color: var(--accent); }
.captcha-row { display: flex; gap: 8px; align-items: center; }
.captcha-row img { border-radius: 8px; height: 48px; }
.banner { padding: 8px 10px; border-radius: 8px; background: #123; }
.banner.error { background: #3a1520; color: #ffd0d6; }
.muted { color: var(--muted); }

.nav {
    position: fixed;
    inset: 0 auto 0 0;
    width: 220px;
    background: var(--panel);
    border-right: 1px solid var(--line);
    padding: 18px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.brand { font-weight: 800; font-size: 20px; color: var(--accent); margin-bottom: 8px; }
.who { display: flex; gap: 8px; align-items: center; font-size: 13px; margin-bottom: 12px; }
.pill { background: #123a4a; color: var(--accent); padding: 2px 8px; border-radius: 999px; font-size: 11px; }
.nav a {
    color: var(--text);
    text-decoration: none;
    padding: 8px 10px;
    border-radius: 8px;
}
.nav a.active, .nav a:hover { background: #152844; }
.logout { margin-top: auto; }
.logout button { background: transparent; color: var(--muted); }

.content { margin-left: 220px; padding: 24px 28px 60px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin: 16px 0; }
.card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 16px;
}
.card .num { font-size: 28px; font-weight: 800; color: var(--accent); }
.panel, .table-wrap, .grid-form, .filters {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 16px;
    margin: 16px 0;
}
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); }
.grid-form, .filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; }
.grid-form input, .grid-form select, .filters input, .filters select, .filters button, .grid-form button {
    width: auto;
}
.team-node {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px;
    margin: 10px 0;
}
.chip { display: inline-block; margin: 4px; padding: 6px 10px; background: #12253f; border-radius: 999px; }
.toast {
    position: fixed;
    right: 24px;
    top: 18px;
    background: #0d3d36;
    border: 1px solid var(--accent);
    color: white;
    padding: 12px 16px;
    border-radius: 10px;
    z-index: 20;
}
.hidden { display: none; }
.status-NEW { color: var(--warn); }
.status-ASSIGNED { color: #79b8ff; }
.status-ACK, .status-WORKING { color: var(--accent); }
.status-DONE { color: #9dffb0; }
.status-REJECT { color: var(--danger); }
.row-actions button { width: auto; margin-right: 6px; padding: 6px 8px; }
.hidden-role { display: none; }

/* =========================================================
   Responsive/mobile layout
   ========================================================= */
.table-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    min-width: 680px;
}

@media (max-width: 768px) {
    body {
        overflow-x: hidden;
    }

    .nav {
        position: sticky;
        top: 0;
        left: 0;
        width: 100%;
        min-height: auto;
        box-sizing: border-box;
        padding: 10px;
        border-right: 0;
        border-bottom: 1px solid var(--line);
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        gap: 6px;
        z-index: 10;
    }

    .brand {
        width: 100%;
        margin: 0 0 2px;
        font-size: 18px;
    }

    .who {
        margin: 0 8px 0 0;
        max-width: 100%;
        flex-wrap: wrap;
    }

    .nav a {
        padding: 7px 9px;
        font-size: 13px;
        white-space: nowrap;
    }

    .logout {
        margin-top: 0;
        margin-left: auto;
    }

    .logout button {
        padding: 7px 9px;
        width: auto;
    }

    .content {
        margin-left: 0;
        padding: 16px 12px 40px;
    }

    h1 {
        font-size: 24px;
        margin-top: 4px;
    }

    h2 {
        font-size: 18px;
    }

    .cards {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px;
        margin: 12px 0;
    }

    .card {
        padding: 12px 9px;
        min-width: 0;
    }

    .card .num {
        font-size: 22px;
    }

    .panel, .table-wrap, .grid-form, .filters {
        padding: 12px;
        margin: 12px 0;
        border-radius: 10px;
        box-sizing: border-box;
    }

    .table-wrap {
        padding: 0;
        border: 0;
        background: transparent;
    }

    table {
        font-size: 13px;
        min-width: 640px;
    }

    th, td {
        padding: 8px 6px;
        white-space: nowrap;
    }

    .grid-form, .filters {
        align-items: stretch;
        flex-direction: column;
    }

    .grid-form input,
    .grid-form select,
    .grid-form button,
    .filters input,
    .filters select,
    .filters button {
        width: 100%;
        box-sizing: border-box;
    }

    .toast {
        left: 12px;
        right: 12px;
        top: 12px;
        text-align: center;
    }
}

@media (max-width: 420px) {
    .cards {
        grid-template-columns: 1fr;
    }

    .card .num {
        font-size: 24px;
    }

    .nav a {
        font-size: 12px;
        padding: 6px 7px;
    }
}
