@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display&family=DM+Sans:wght@300;400;500;600;700&display=swap');

:root {
    --paper: #f7f6f1;
    --ink: #0f1117;
    --accent: #2563eb;
    --light: #dbeafe;
    --muted: #6b7280;
    --border: #e5e4df;
    --green: #059669;
    --red: #dc2626;
    --shadow: 0 8px 30px #0f111712
}

* {
    box-sizing: border-box
}

body {
    font-family: 'DM Sans', sans-serif;
    background: var(--paper);
    color: var(--ink);
    margin: 0
}

h1,
h2,
h3,
.brand,
.serif {
    font-family: 'DM Serif Display', serif;
    font-weight: 400
}

a {
    color: inherit
}

button,
input,
select,
textarea {
    font: inherit
}

button {
    cursor: pointer
}

.top {
    background: #fff;
    border-bottom: 1px solid var(--border);
    padding: 13px max(20px, calc((100% - 1180px)/2));
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    min-height: 66px;
    position: sticky;
    top: 0;
    z-index: 3
}

.brand {
    display: flex;
    gap: 10px;
    align-items: center;
    font-size: 22px;
    text-decoration: none
}

.mark {
    display: inline-grid;
    place-items: center;
    width: 39px;
    height: 39px;
    border-radius: 11px;
    color: white;
    background: var(--accent);
    font: 24px 'DM Sans'
}

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

.nav a,
.nav button {
    border: 0;
    background: transparent;
    text-decoration: none;
    padding: 9px 11px;
    border-radius: 9px;
    font-size: 13px;
    font-weight: 600;
    color: #475569
}

.nav a:hover,
.nav a.active {
    background: var(--light);
    color: var(--accent)
}

.shell {
    max-width: 1180px;
    padding: 32px 20px 70px;
    margin: auto
}

.muted {
    color: var(--muted)
}

.eyebrow {
    color: var(--accent);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .11em;
    text-transform: uppercase
}

.hero {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    margin-bottom: 22px
}

.hero h1 {
    font-size: 35px;
    margin: 4px 0
}

.hero p {
    margin: 0;
    color: var(--muted)
}

.grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px
}

.grid.two {
    grid-template-columns: repeat(2, 1fr)
}

.panel,
.metric {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: var(--shadow)
}

.panel {
    padding: 25px;
    margin-top: 18px
}

.panel h2 {
    margin: 0 0 8px;
    font-size: 23px
}

.metric {
    padding: 22px
}

.metric .value {
    font: 34px 'DM Serif Display';
    margin: 12px 0 4px;
    color: var(--accent)
}

.metric .label {
    font-size: 13px;
    color: var(--muted)
}

.action-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px
}

.action {
    display: block;
    border: 1px solid var(--border);
    background: #fff;
    border-radius: 14px;
    text-decoration: none;
    padding: 21px;
    transition: transform .15s
}

.action:hover {
    transform: translateY(-2px);
    border-color: var(--accent)
}

.action .emoji {
    font-size: 28px
}

.action strong {
    display: block;
    margin: 10px 0 6px
}

.action p {
    margin: 0;
    color: var(--muted);
    font-size: 13px
}

.btn {
    background: var(--accent);
    color: #fff;
    border: 0;
    padding: 11px 18px;
    border-radius: 11px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none
}

.btn:hover {
    background: #1d4ed8
}

.btn.secondary {
    color: var(--accent);
    border: 1px solid #bfdbfe;
    background: #eff6ff
}

.btn.light {
    background: #fff;
    color: #334155;
    border: 1px solid var(--border)
}

.btn.danger {
    color: #b91c1c;
    background: #fff1f2
}

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

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 0 0 16px
}

.field label {
    font-size: 12px;
    font-weight: 700;
    color: #475569
}

.field input,
.field select,
.field textarea,
.search {
    width: 100%;
    background: #fafaf8;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    padding: 12px;
    min-height: 45px;
    outline: none
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.search:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--light)
}

.field textarea {
    min-height: 100px;
    resize: vertical
}

.table-wrap {
    overflow-x: auto
}

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

.table th {
    text-align: left;
    background: #f8fafc;
    color: #64748b
}

.table th,
.table td {
    padding: 13px 10px;
    border-bottom: 1px solid var(--border)
}

.pill {
    font-size: 11px;
    padding: 4px 9px;
    border-radius: 999px;
    background: #dbeafe;
    color: #1d4ed8;
    display: inline-block
}

.empty {
    padding: 30px 14px;
    text-align: center;
    color: var(--muted)
}

.notice {
    padding: 13px 15px;
    border-radius: 11px;
    border: 1px solid #bfdbfe;
    background: #eff6ff;
    color: #1e40af;
    margin: 14px 0;
    font-size: 13px
}

.message {
    min-height: 22px;
    margin-top: 10px;
    color: #b91c1c;
    font-size: 13px
}

.message.good {
    color: var(--green)
}

.layout-chat {
    height: calc(100vh - 66px);
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    background: #fff;
    max-width: 1180px;
    margin: auto
}

.sidebar {
    border-right: 1px solid var(--border);
    overflow-y: auto
}

.side-header {
    padding: 20px;
    border-bottom: 1px solid var(--border)
}

.ticket {
    padding: 16px;
    border-bottom: 1px solid var(--border);
    cursor: pointer
}

.ticket:hover,
.ticket.selected {
    background: #eff6ff
}

.chat-panel {
    display: flex;
    flex-direction: column;
    min-height: 0
}

.chat-head {
    padding: 17px 20px;
    border-bottom: 1px solid var(--border)
}

.messages {
    flex: 1;
    overflow-y: auto;
    background: linear-gradient(180deg, #fafafa, var(--paper));
    padding: 20px;
    min-height: 190px
}

.bubble {
    padding: 11px 14px;
    border-radius: 15px;
    background: #fff;
    border: 1px solid var(--border);
    max-width: 80%;
    display: table;
    margin: 10px 0;
    white-space: pre-wrap;
    overflow-wrap: anywhere
}

.bubble.mine {
    margin-left: auto;
    color: #fff;
    background: var(--accent)
}

.bubble small {
    display: block;
    opacity: .75;
    font-size: 10px;
    margin-top: 6px
}

.composer {
    padding: 14px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 8px
}

.composer textarea {
    flex: 1;
    min-height: 45px;
    border: 1px solid var(--border);
    padding: 12px;
    border-radius: 12px;
    resize: none
}

.login-layout {
    max-width: 920px;
    min-height: 535px;
    margin: 8vh auto;
    background: #fff;
    display: grid;
    grid-template-columns: 1fr 1fr;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: var(--shadow)
}

.login-brand {
    background: linear-gradient(145deg, #1e3a8a, var(--accent), #3b82f6);
    padding: 45px;
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: space-between
}

.login-brand h1 {
    font-size: 39px;
    line-height: 1.15
}

.login-content {
    padding: 55px 45px;
    display: flex;
    flex-direction: column;
    justify-content: center
}

.login-content h2 {
    font-size: 32px
}

.login-feature {
    background: #ffffff1b;
    border: 1px solid #ffffff32;
    padding: 12px;
    margin-top: 10px;
    border-radius: 10px;
    font-size: 13px
}

.avatar {
    height: 37px;
    width: 37px;
    border-radius: 100px;
    object-fit: cover
}

.footer {
    color: var(--muted);
    font-size: 12px;
    text-align: center;
    padding: 20px
}

.hidden {
    display: none !important
}

@media(max-width:900px) {
    .grid {
        grid-template-columns: repeat(2, 1fr)
    }

    .action-grid {
        grid-template-columns: repeat(2, 1fr)
    }

    .top {
        position: relative
    }

    .nav {
        gap: 0
    }
}

@media(max-width:650px) {
    .shell {
        padding: 20px 13px 55px
    }

    .top {
        display: block
    }

    .brand {
        margin-bottom: 8px
    }

    .grid,
    .grid.two,
    .action-grid,
    .form-grid {
        grid-template-columns: 1fr
    }

    .hero {
        align-items: flex-start;
        flex-direction: column
    }

    .hero h1 {
        font-size: 29px
    }

    .login-layout {
        display: block;
        margin: 30px 15px;
        min-height: unset
    }

    .login-brand {
        padding: 25px
    }

    .login-brand h1 {
        font-size: 28px
    }

    .login-content {
        padding: 32px 25px
    }

    .layout-chat {
        grid-template-columns: 1fr;
        height: calc(100dvh - 112px)
    }

    .layout-chat .sidebar {
        max-height: 190px;
        border-right: none;
        border-bottom: 1px solid var(--border)
    }

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

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.brand-icon {
    width: 38px;
    height: 38px;
    object-fit: contain;
    flex-shrink: 0;
}

@media (max-width: 600px) {
    .brand-icon {
        width: 32px;
        height: 32px;
    }
}