:root {
    --p3000-blue: #123f73;
    --p3000-blue-dark: #0b2a4e;
    --p3000-blue-soft: #eaf2fb;
    --p3000-orange: #f29f3d;
    --p3000-orange-soft: #fff4e7;
    --p3000-green: #1f9d55;
    --p3000-red: #d33f49;
    --p3000-yellow: #d89b19;
    --p3000-gray-50: #f7f9fc;
    --p3000-gray-100: #eef2f6;
    --p3000-gray-200: #d9e1ea;
    --p3000-gray-500: #6b7785;
    --p3000-gray-700: #344054;
    --p3000-white: #ffffff;
    --shadow: 0 18px 40px rgba(18, 63, 115, 0.10);
    --radius: 18px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: linear-gradient(180deg, #f7f9fc 0%, #eef5fb 100%);
    color: var(--p3000-gray-700);
    min-height: 100vh;
}

a { color: var(--p3000-blue); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 14px clamp(18px, 3vw, 42px);
    background: rgba(255, 255, 255, 0.94);
    border-bottom: 1px solid var(--p3000-gray-200);
    backdrop-filter: blur(12px);
}

.topbar__brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--p3000-blue-dark);
}

.topbar__brand span {
    display: block;
    font-size: 12px;
    color: var(--p3000-gray-500);
    margin-top: 2px;
}

.brand-mark,
.auth-logo {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--p3000-blue), var(--p3000-blue-dark));
    color: var(--p3000-white);
    font-weight: 800;
    letter-spacing: -0.04em;
    box-shadow: 0 10px 24px rgba(18, 63, 115, 0.24);
}

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

.topbar__nav a {
    padding: 10px 14px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 14px;
    color: var(--p3000-blue-dark);
}

.topbar__nav a.active,
.topbar__nav a:hover {
    background: var(--p3000-blue-soft);
    text-decoration: none;
}

.page {
    width: min(1180px, calc(100% - 32px));
    margin: 28px auto 48px;
}

.footer {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto 28px;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    font-size: 12px;
    color: var(--p3000-gray-500);
}
.footer-single { justify-content: center; }

.auth-shell {
    display: grid;
    place-items: center;
    min-height: calc(100vh - 170px);
}

.auth-card,
.panel,
.stat-card,
.hero,
.ticket-head {
    background: var(--p3000-white);
    border: 1px solid var(--p3000-gray-200);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.auth-card {
    width: min(460px, 100%);
    padding: 34px;
}

.auth-card__intro { text-align: center; margin-bottom: 26px; }
.auth-card__intro .auth-logo { margin: 0 auto 16px; width: 60px; height: 60px; }
h1, h2, h3 { color: var(--p3000-blue-dark); margin-top: 0; }
h1 { font-size: clamp(28px, 4vw, 42px); margin-bottom: 10px; letter-spacing: -0.03em; }
h2 { font-size: 22px; }
p { line-height: 1.62; }

.form { display: grid; gap: 14px; }
.form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.form-row { display: grid; gap: 8px; }
.form-row-full { grid-column: 1 / -1; }
label { font-weight: 800; color: var(--p3000-blue-dark); font-size: 14px; }
input, select, textarea {
    width: 100%;
    border: 1px solid var(--p3000-gray-200);
    border-radius: 14px;
    padding: 13px 14px;
    font: inherit;
    background: var(--p3000-white);
    color: var(--p3000-gray-700);
    outline: none;
}
input:focus, select:focus, textarea:focus {
    border-color: var(--p3000-blue);
    box-shadow: 0 0 0 4px rgba(18, 63, 115, 0.10);
}
textarea { resize: vertical; min-height: 140px; }
.field-help { color: var(--p3000-gray-500); font-weight: 700; line-height: 1.5; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 999px;
    padding: 12px 18px;
    font-weight: 800;
    cursor: pointer;
    font-size: 14px;
    transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}
.btn:hover { transform: translateY(-1px); text-decoration: none; }
.btn-primary { background: var(--p3000-orange); color: #231709; box-shadow: 0 10px 22px rgba(242, 159, 61, 0.28); }
.btn-secondary { background: var(--p3000-blue); color: var(--p3000-white); }
.btn-light { background: var(--p3000-gray-100); color: var(--p3000-blue-dark); }
.btn-full { width: 100%; }
.form-actions { display: flex; justify-content: flex-end; gap: 12px; flex-wrap: wrap; }

.auth-links { margin-top: 18px; text-align: center; font-weight: 700; }

.alert,
.notice {
    padding: 14px 16px;
    border-radius: 14px;
    margin-bottom: 18px;
    border: 1px solid transparent;
    font-weight: 700;
    line-height: 1.55;
}
.alert-success { background: #eaf8f0; color: #11613a; border-color: #bfe8cf; }
.alert-error { background: #fdecec; color: #9d1f2e; border-color: #f5c2c7; }
.alert-info,
.notice-info { background: var(--p3000-blue-soft); color: var(--p3000-blue-dark); border-color: #c7d9ee; }
.notice-warning { background: #fff9db; color: #806000; border-color: #ffe08a; }

.hero,
.ticket-head {
    padding: clamp(24px, 4vw, 38px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 22px;
    background:
        radial-gradient(circle at top right, rgba(242, 159, 61, 0.18), transparent 28%),
        var(--p3000-white);
}
.hero-compact { align-items: flex-start; }
.eyebrow {
    display: inline-block;
    color: var(--p3000-orange);
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 12px;
    margin-bottom: 8px;
}
.hero p,
.ticket-head p { max-width: 720px; margin-bottom: 0; color: var(--p3000-gray-500); }

.welcome-box {
    display: grid;
    gap: 4px;
    margin: 14px 0 12px;
    padding: 14px 16px;
    max-width: 720px;
    border: 1px solid var(--p3000-gray-200);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.76);
}
.welcome-box strong { color: var(--p3000-blue-dark); font-size: 17px; }
.welcome-box span { color: var(--p3000-gray-500); font-weight: 700; font-size: 14px; }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 22px;
}
.stat-card { padding: 20px; }
.stat-card span { display: block; font-weight: 800; color: var(--p3000-gray-500); font-size: 13px; }
.stat-card strong { display: block; color: var(--p3000-blue-dark); font-size: 36px; margin-top: 8px; }

.panel { padding: 24px; margin-bottom: 22px; }
.panel__header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.panel__header h2 { margin-bottom: 0; }
.panel__header span { color: var(--p3000-gray-500); font-weight: 700; }

.filters {
    display: grid;
    grid-template-columns: 1.3fr repeat(3, minmax(140px, 1fr)) auto;
    align-items: end;
    gap: 14px;
}
.filter-actions { display: flex; gap: 8px; }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; min-width: 940px; }
.table th, .table td { text-align: left; padding: 14px 12px; border-bottom: 1px solid var(--p3000-gray-200); vertical-align: middle; }
.table th { color: var(--p3000-blue-dark); font-size: 13px; text-transform: uppercase; letter-spacing: 0.04em; }
.table tr:hover td { background: var(--p3000-gray-50); }
.ticket-code { font-weight: 900; }
.dot-note { display: inline-flex; margin-left: 8px; padding: 3px 7px; border-radius: 999px; background: #eaf8f0; color: #11613a; font-size: 11px; font-weight: 900; }

.badge,
.priority {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 900;
    white-space: nowrap;
}
.badge-open { background: var(--p3000-orange-soft); color: #8a4f0e; }
.badge-work { background: var(--p3000-blue-soft); color: var(--p3000-blue-dark); }
.badge-wait { background: #fff9db; color: #806000; }
.badge-closed { background: #edf2f7; color: #4a5568; }
.badge-neutral { background: var(--p3000-gray-100); color: var(--p3000-gray-700); }
.priority-low { background: #eef8f1; color: #166534; }
.priority-normal { background: var(--p3000-blue-soft); color: var(--p3000-blue-dark); }
.priority-high { background: #fff4e7; color: #8a4f0e; }
.priority-urgent { background: #fdecec; color: #9d1f2e; }

.empty-state {
    text-align: center;
    padding: 46px 18px;
    background: var(--p3000-gray-50);
    border: 1px dashed var(--p3000-gray-200);
    border-radius: var(--radius);
}
.empty-state p { color: var(--p3000-gray-500); }

.pagination { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.pagination a { display: grid; place-items: center; min-width: 36px; height: 36px; border-radius: 999px; background: var(--p3000-gray-100); font-weight: 900; }
.pagination a.active { background: var(--p3000-blue); color: var(--p3000-white); }

.ticket-head { align-items: flex-start; }
.back-link { display: inline-block; margin-bottom: 14px; font-weight: 800; }
.ticket-meta { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; color: var(--p3000-gray-500); font-weight: 700; }
.detail-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin: 0; }
.detail-grid div { padding: 14px; border-radius: 14px; background: var(--p3000-gray-50); border: 1px solid var(--p3000-gray-200); }
.detail-grid dt { font-weight: 900; color: var(--p3000-blue-dark); font-size: 13px; margin-bottom: 6px; }
.detail-grid dd { margin: 0; color: var(--p3000-gray-700); }
.conversation h2 { margin-bottom: 18px; }
.message {
    border: 1px solid var(--p3000-gray-200);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 14px;
    background: var(--p3000-gray-50);
}
.message-manager { background: var(--p3000-blue-soft); border-color: #c7d9ee; }
.message__head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 8px;
    color: var(--p3000-blue-dark);
}
.message__head span { color: var(--p3000-gray-500); font-size: 13px; }
.message p { margin: 0; }
.attachments { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.attachment-link { display: inline-flex; gap: 6px; align-items: center; border-radius: 999px; background: var(--p3000-white); border: 1px solid var(--p3000-gray-200); padding: 8px 12px; font-weight: 900; }
.attachment-link span { color: var(--p3000-gray-500); font-size: 12px; }

@media (max-width: 980px) {
    .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .filter-actions { grid-column: 1 / -1; }
    .detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 800px) {
    .topbar, .hero, .ticket-head { align-items: flex-start; flex-direction: column; }
    .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .form-grid { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
    .page, .footer { width: min(100% - 20px, 1180px); }
    .auth-card, .panel, .hero, .ticket-head { padding: 20px; }
    .stats-grid, .filters, .detail-grid { grid-template-columns: 1fr; }
    .topbar__nav { width: 100%; }
    .topbar__nav a { flex: 1; text-align: center; }
    .filter-actions { flex-direction: column; }
}
