/* TAP - Travel Ads Pro Helpdesk — brand: #ED174F (accent), #2D343E (dark) */
:root {
    --brand: #ed174f;
    --brand-dark: #c81241;
    --brand-soft: #fdeaf0;
    --ink: #2d343e;
    --ink-soft: #5a6472;
    --line: #e4e7ec;
    --bg: #f6f7f9;
    --card: #ffffff;
    --ok: #1e9e5a;
    --ok-soft: #e3f5eb;
    --warn: #b7791f;
    --warn-soft: #fdf3e0;
    --info: #2563ab;
    --info-soft: #e7f0fa;
    --radius: 10px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.55;
    color: var(--ink);
    background: var(--bg);
    display: flex;
    min-height: 100vh;
    flex-direction: column;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { color: var(--ink); line-height: 1.25; margin: 0 0 .5em; }
h1 { font-size: 1.7rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.1rem; }
img { max-width: 100%; }

.container { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 20px; }
.main-content { flex: 1; padding-top: 28px; padding-bottom: 48px; }

/* Header */
.site-header {
    background: var(--card);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 1px 3px rgba(45, 52, 62, .06);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; min-height: 64px; gap: 16px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand img { height: 42px; width: auto; }
.brand-suffix {
    font-weight: 700; color: var(--ink); font-size: 1.05rem;
    border-left: 2px solid var(--line); padding-left: 10px;
}
.main-nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.main-nav a, .nav-link-btn {
    color: var(--ink-soft); font-weight: 600; font-size: .92rem;
    padding: 8px 12px; border-radius: 8px;
}
.main-nav a:hover, .nav-link-btn:hover { background: var(--bg); text-decoration: none; color: var(--ink); }
.main-nav a.active { color: var(--brand); background: var(--brand-soft); }
.nav-admin { color: var(--ink); }
.nav-link-btn { background: none; border: 0; cursor: pointer; font-family: inherit; }
.nav-user { color: var(--ink-soft); font-weight: 400; }
.inline-form { display: inline; }

/* Footer */
.site-footer { background: var(--ink); color: #b9c0c9; font-size: .85rem; margin-top: auto; }
.footer-inner { display: flex; justify-content: space-between; padding: 18px 20px; gap: 12px; flex-wrap: wrap; }
.site-footer a { color: #dfe3e8; }

/* Buttons */
.btn {
    display: inline-block; border: 1px solid transparent; border-radius: 8px;
    padding: 9px 18px; font-size: .92rem; font-weight: 600; cursor: pointer;
    font-family: inherit; line-height: 1.4; text-align: center;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); color: #fff; }
.btn-outline { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-outline:hover { border-color: var(--ink-soft); background: var(--card); }
.btn-danger-outline { background: transparent; color: var(--brand); border-color: var(--brand); }
.btn-danger-outline:hover { background: var(--brand-soft); }
.btn-sm { padding: 6px 12px; font-size: .85rem; }
.btn-block { display: block; width: 100%; }

/* Cards & panels */
.card {
    background: var(--card); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 22px;
    box-shadow: 0 1px 2px rgba(45, 52, 62, .04);
}
.card + .card { margin-top: 16px; }
.card-title { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-title h2, .card-title h1 { margin: 0; }

/* Forms */
label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: 5px; }
.field { margin-bottom: 16px; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"],
select, textarea {
    width: 100%; padding: 10px 12px; font-size: .95rem; font-family: inherit;
    border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus {
    outline: none; border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(237, 23, 79, .12);
}
textarea { min-height: 140px; resize: vertical; }
.field-hint { font-size: .8rem; color: var(--ink-soft); margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.checkbox-label { display: flex; align-items: center; gap: 8px; font-weight: 400; }
.checkbox-label input { width: auto; }

/* Flash messages */
.flash { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: .92rem; font-weight: 500; }
.flash-success { background: var(--ok-soft); color: var(--ok); border: 1px solid #bfe6cf; }
.flash-error { background: var(--brand-soft); color: var(--brand-dark); border: 1px solid #f6c2d1; }

/* Badges */
.badge {
    display: inline-block; padding: 3px 10px; border-radius: 99px;
    font-size: .75rem; font-weight: 700; white-space: nowrap;
}
.badge-open           { background: var(--info-soft); color: var(--info); }
.badge-answered       { background: var(--ok-soft); color: var(--ok); }
.badge-customer_reply { background: var(--warn-soft); color: var(--warn); }
.badge-closed         { background: #eceef1; color: var(--ink-soft); }
.badge-low    { background: #eceef1; color: var(--ink-soft); }
.badge-normal { background: var(--info-soft); color: var(--info); }
.badge-high   { background: var(--warn-soft); color: var(--warn); }
.badge-urgent { background: var(--brand-soft); color: var(--brand); }
.badge-draft  { background: var(--warn-soft); color: var(--warn); }
.badge-published { background: var(--ok-soft); color: var(--ok); }
.badge-admin { background: var(--ink); color: #fff; }
.badge-user  { background: #eceef1; color: var(--ink-soft); }
.badge-driver { background: var(--brand-soft); color: var(--brand); margin-left: 6px; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th { text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-soft); padding: 10px 12px; border-bottom: 2px solid var(--line); }
td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafbfc; }
.td-muted { color: var(--ink-soft); font-size: .85rem; white-space: nowrap; }

/* Hero (KB home) */
.hero {
    background: linear-gradient(135deg, var(--ink) 0%, #3c4552 100%);
    border-radius: var(--radius); color: #fff; text-align: center;
    padding: 56px 24px; margin-bottom: 28px;
}
.hero h1 { color: #fff; font-size: 2rem; margin-bottom: 6px; }
.hero p { color: #c3c9d1; margin: 0 0 24px; }
.hero .accent { color: var(--brand); }
.search-form { display: flex; max-width: 560px; margin: 0 auto; gap: 8px; }
.search-form input { padding: 13px 16px; font-size: 1rem; border: 0; }
.search-form .btn { padding: 13px 24px; }

/* KB grid */
.kb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.kb-cat-card { display: block; color: inherit; }
.kb-cat-card:hover { text-decoration: none; border-color: var(--brand); }
.kb-cat-card h3 { color: var(--brand); margin-bottom: 4px; }
.kb-cat-card p { color: var(--ink-soft); font-size: .88rem; margin: 0 0 8px; }
.kb-count { font-size: .78rem; font-weight: 700; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .04em; }
.kb-list { list-style: none; margin: 0; padding: 0; }
.kb-list li { border-bottom: 1px solid var(--line); }
.kb-list li:last-child { border-bottom: 0; }
.kb-list a { display: block; padding: 12px 4px; font-weight: 600; }
.kb-list .meta { font-size: .8rem; color: var(--ink-soft); font-weight: 400; }
.breadcrumb { font-size: .85rem; color: var(--ink-soft); margin-bottom: 14px; }
.breadcrumb a { color: var(--ink-soft); }

/* Article body */
.article-body { font-size: 1rem; }
.article-body h2, .article-body h3 { margin-top: 1.4em; }
.article-body pre {
    background: var(--ink); color: #e8ebee; padding: 14px 16px;
    border-radius: 8px; overflow-x: auto; font-size: .88rem;
}
.article-body code { background: #eceef1; padding: 1px 6px; border-radius: 4px; font-size: .88em; }
.article-body pre code { background: none; padding: 0; }
.article-meta { color: var(--ink-soft); font-size: .85rem; margin-bottom: 18px; }
.feedback-box { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--line); }

/* Ticket thread */
.msg { display: flex; gap: 14px; margin-bottom: 16px; }
.msg-avatar {
    flex: 0 0 40px; height: 40px; border-radius: 50%;
    background: var(--ink); color: #fff; font-weight: 700;
    display: flex; align-items: center; justify-content: center; font-size: .95rem;
}
.msg-staff .msg-avatar { background: var(--brand); }
.msg-body { flex: 1; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; min-width: 0; }
.msg-staff .msg-body { border-color: #f6c2d1; background: #fffafb; }
.msg-internal .msg-body { border-color: #ecd9a8; background: #fffdf4; }
.msg-head { display: flex; justify-content: space-between; gap: 10px; font-size: .85rem; margin-bottom: 6px; flex-wrap: wrap; }
.msg-author { font-weight: 700; }
.msg-tag { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--brand); }
.msg-tag-internal { color: var(--warn); }
.msg-time { color: var(--ink-soft); }
.msg-text p:first-child { margin-top: 0; }
.msg-text p:last-child { margin-bottom: 0; }
.attach-list { margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--line); font-size: .85rem; }
.attach-list a { margin-right: 14px; }

/* Stats (admin dashboard) */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.stat .n { font-size: 1.9rem; font-weight: 800; color: var(--ink); line-height: 1.1; }
.stat .l { font-size: .8rem; font-weight: 600; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .04em; }
.stat-accent .n { color: var(--brand); }

/* Filter bar */
.filter-bar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.filter-bar select, .filter-bar input { width: auto; }
.filter-bar input[type="text"] { min-width: 220px; }
.tabs { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.tabs a { padding: 7px 14px; border-radius: 99px; font-size: .88rem; font-weight: 600; color: var(--ink-soft); border: 1px solid var(--line); background: var(--card); }
.tabs a:hover { text-decoration: none; color: var(--ink); }
.tabs a.active { background: var(--ink); color: #fff; border-color: var(--ink); }

/* Auth pages */
.auth-wrap { max-width: 420px; margin: 32px auto; }
.auth-wrap .card { padding: 28px; }
.auth-alt { text-align: center; margin-top: 14px; font-size: .9rem; color: var(--ink-soft); }

/* Sidebar layout */
.split { display: grid; grid-template-columns: 1fr 300px; gap: 20px; align-items: start; }
.side-meta dt { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-soft); margin-top: 12px; }
.side-meta dd { margin: 2px 0 0; }
.side-meta dt:first-child { margin-top: 0; }

.empty { text-align: center; color: var(--ink-soft); padding: 40px 16px; }
.empty .big { font-size: 2.2rem; }

.page-head { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { margin: 0; }

@media (max-width: 820px) {
    .split { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .hero { padding: 36px 18px; }
    .hero h1 { font-size: 1.5rem; }
    .search-form { flex-direction: column; }
}
