/*
 * Abrevia theme for the osTicket customer pages (support.abrevia.de, ADR 0069).
 * Injected by the host nginx (nginx/abrevia-support-theme.conf), loaded after osTicket's
 * own CSS. Tokens mirror selling/website/src/index.css (light theme): system font stack,
 * App-Blau primary, 4/8 px spacing, radius 12/8 px. No glows, no colored shadows, no pills.
 */
:root {
    --ab-bg: #ffffff;
    --ab-surface: #f4f4f8;        /* --muted 240 24% 96% */
    --ab-ink: #1e1e20;            /* --foreground */
    --ab-ink-muted: #4f4f54;      /* --muted-foreground, >= 7:1 on white */
    --ab-border: #dfdfe3;         /* --border */
    --ab-primary: #0462b4;        /* --primary 208 96% 36%, 6.1:1 on white */
    --ab-primary-hover: #034f92;
    --ab-primary-soft: #e8f1fa;
    --ab-success: #146c43;
    --ab-danger: #b42318;
    --ab-warning-bg: #fff7e0;
    --ab-radius: 12px;
    --ab-radius-sm: 8px;
    --ab-font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ---------- base ---------- */
html, body {
    background: var(--ab-surface) !important;
    color: var(--ab-ink);
    font-family: var(--ab-font) !important;
    font-size: 16px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}
body, input, select, textarea, button, table, td, th { font-family: var(--ab-font) !important; }
a { color: var(--ab-primary); text-underline-offset: 2px; }
a:hover { color: var(--ab-primary-hover); }
:focus-visible { outline: 2px solid var(--ab-primary) !important; outline-offset: 2px; }
h1, h2, h3 { color: var(--ab-ink); font-weight: 650; letter-spacing: -0.01em; line-height: 1.25; }
h1 { font-size: 1.75rem; margin: 0 0 16px; }
h2 { font-size: 1.25rem; margin: 24px 0 8px; }
h3 { font-size: 1.0625rem; }
hr { border: 0; border-top: 1px solid var(--ab-border); }
img { max-width: 100%; height: auto; }

/* ---------- page frame ---------- */
#container {
    width: auto !important;
    max-width: 1040px;
    margin: 0 auto !important;
    padding: 0 16px 32px;
    background: transparent !important;
    box-shadow: none !important;
    border: 0 !important;
}
#header {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 16px;
    height: auto !important;
    padding: 16px 0 !important;
    background: transparent !important;
}
#header #logo {
    order: 1;
    display: inline-flex !important;
    align-items: center;
    gap: 12px;
    float: none !important;
    height: auto !important;
    width: auto !important;
    max-width: none !important;
    text-decoration: none;
    color: var(--ab-ink);
}
/* Logo comes from osTicket (Admin → Einstellungen → Unternehmen → Logos, file theme/logo-support.png, 570×144 @2x). */
#header #logo img {
    display: block !important;
    height: 40px !important;
    width: auto !important;
    max-width: none !important;
    max-height: none !important;
}
#header .pull-right {
    order: 2;
    float: none !important;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 12px;
    font-size: 0.9375rem;
    color: var(--ab-ink-muted);
}
#header .pull-right { margin-left: auto; }
#header .pull-right p { width: auto !important; margin: 0 !important; padding: 0 !important; text-align: right; }
#header .pull-right p:empty { display: none; }
#header .pull-right a { text-decoration: none; padding: 10px 4px; }
#header .pull-right a:hover { text-decoration: underline; }

/* ---------- navigation ---------- */
#nav {
    order: 3;
    flex-basis: 100%;
    display: flex !important;
    flex-wrap: wrap;
    gap: 4px;
    margin: 4px 0 0 !important;
    padding: 4px !important;
    height: auto !important;
    background: var(--ab-bg) !important;
    border: 1px solid var(--ab-border) !important;
    border-radius: var(--ab-radius);
    box-shadow: none !important;
}
#nav li { float: none !important; margin: 0 !important; list-style: none; }
#nav li a {
    display: flex !important;
    align-items: center;
    min-height: 44px;
    height: auto !important;
    padding: 0 14px !important;
    border-radius: var(--ab-radius-sm);
    background: none !important;          /* osTicket nav icons */
    color: var(--ab-ink-muted) !important;
    font-size: 0.9375rem;
    font-weight: 550;
    line-height: 1.2 !important;
    text-decoration: none;
    border: 0 !important;
}
#nav li a:hover { background: var(--ab-surface) !important; color: var(--ab-ink) !important; }
#nav li a.active { background: var(--ab-primary-soft) !important; color: var(--ab-primary) !important; }

/* ---------- content card ---------- */
#content {
    margin: 16px 0 0 !important;
    padding: 32px !important;
    background: var(--ab-bg);
    border: 1px solid var(--ab-border);
    border-radius: var(--ab-radius);
    overflow-x: auto;
}
#content > :first-child { margin-top: 0; }
#landing_page { display: flex; flex-wrap: wrap; gap: 32px; }
#landing_page > .clear { display: none; }
#landing_page .main-content { flex: 1 1 420px; float: none !important; width: auto !important; }
#landing_page .sidebar { order: 2; flex: 0 1 300px; float: none !important; width: auto !important; margin: 0 !important; }
#landing_page .thread-body { padding: 0 !important; max-width: 68ch; color: var(--ab-ink-muted); }
#landing_page .thread-body h1 { margin-top: 0 !important; color: var(--ab-ink); }
.front-page-button { float: none !important; width: auto !important; }
.front-page-button p { margin: 0 0 12px; }
.front-page-button a.button { display: flex !important; width: 100% !important; box-sizing: border-box; justify-content: center; }
#landing_page .clear + div:empty, #landing_page > div:last-child:empty { display: none; }

/* ---------- customer sign-in ---------- */
#clientLogin {
    width: auto !important;
    max-width: 720px;
    margin: 24px 0 !important;
    padding: 24px !important;
    background: var(--ab-surface) none !important;   /* drops the stock padlock image */
    border: 1px solid var(--ab-border) !important;
    border-radius: var(--ab-radius);
    box-shadow: none !important;
}
#clientLogin > div { display: flex !important; flex-wrap: wrap; gap: 24px; }
#clientLogin .login-box {
    flex: 1 1 260px;
    width: auto !important;
    float: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    box-shadow: none !important;
}
#clientLogin .login-box > div { margin-bottom: 12px; }
#clientLogin .login-box input[type=text], #clientLogin .login-box input[type=password] { width: 100% !important; }
#clientLogin .login-box .btn { width: 100%; }
#clientLogin > div > div:last-child { flex: 1 1 200px; display: block !important; padding: 0 !important; line-height: 1.6; }
/* Staff use /scp directly (osTicket login + 2FA); no agent link for customers. */
#clientLogin div:has(> a[href$="/scp/"]) { display: none; }

/* ---------- buttons ---------- */
.button, a.button, input[type=submit], input[type=button], input[type=reset], button:not(.close):not(.redactor-toolbar button) {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 20px !important;
    border-radius: var(--ab-radius-sm) !important;
    border: 1px solid var(--ab-border) !important;
    background: var(--ab-bg) !important;
    background-image: none !important;
    box-shadow: none !important;
    text-shadow: none !important;
    color: var(--ab-ink) !important;
    font-size: 0.9375rem !important;
    font-weight: 600 !important;
    line-height: 1.2 !important;
    text-decoration: none !important;
    cursor: pointer;
    transition: background-color .15s ease, border-color .15s ease;
}
.button:hover, input[type=reset]:hover, input[type=button]:hover { background: var(--ab-surface) !important; }
a.button.blue, .button.blue, input[type=submit] {
    background: var(--ab-primary) !important;
    border-color: var(--ab-primary) !important;
    color: #fff !important;
}
a.button.blue:hover, .button.blue:hover, input[type=submit]:hover {
    background: var(--ab-primary-hover) !important;
    border-color: var(--ab-primary-hover) !important;
}
a.button.green, .button.green {
    background: var(--ab-bg) !important;
    border-color: var(--ab-primary) !important;
    color: var(--ab-primary) !important;
}
a.button.green:hover, .button.green:hover { background: var(--ab-primary-soft) !important; }
.front-page-button .button { width: 100%; }
.button::before, .button > i.icon-chevron-right { display: none; }

/* ---------- forms ---------- */
input[type=text], input[type=email], input[type=tel], input[type=password], input[type=number],
input[type=search], input[type=date], input:not([type]), select, textarea {
    box-sizing: border-box;
    min-height: 44px;
    max-width: 100%;
    padding: 8px 12px !important;
    border: 1px solid #b8b8c0 !important;   /* 3:1 against white for the field edge */
    border-radius: var(--ab-radius-sm) !important;
    background: var(--ab-bg) !important;
    color: var(--ab-ink) !important;
    font-size: 1rem !important;
    box-shadow: none !important;
}
input[size="5"] { width: 6em; }
textarea { min-height: 140px; width: 100%; }
input:focus, select:focus, textarea:focus { border-color: var(--ab-primary) !important; outline: 2px solid var(--ab-primary-soft); }
label, .form-header h3, .form-header b { color: var(--ab-ink); }
#ticketForm table, #clientLogin table, form table { width: 100% !important; max-width: 100%; border-collapse: collapse; }
#ticketForm td, form table td { padding: 8px 0; vertical-align: top; }
.form-header { margin: 24px 0 8px !important; }
.form-header h3 { font-size: 1.0625rem !important; margin: 0 0 4px !important; }
.form-header em, .form-header i, em { color: var(--ab-ink-muted); font-style: normal; }
.error, span.error, font.error, .required.error { color: var(--ab-danger) !important; }
#msg_error, #msg_notice, #msg_warning, .error_bar, .warning_bar, .notice_bar {
    border-radius: var(--ab-radius-sm) !important;
    background-image: none !important;
    padding: 12px 16px !important;
    margin: 0 0 16px !important;
    border: 1px solid var(--ab-border) !important;
    color: var(--ab-ink) !important;
}
#msg_error, .error_bar { background: #fdecea !important; border-color: #f2b8b1 !important; }
#msg_notice, .notice_bar { background: #e9f6ef !important; border-color: #a9d8bd !important; }
#msg_warning, .warning_bar { background: var(--ab-warning-bg) !important; border-color: #f0d68a !important; }
.redactor-box, .redactor-layer, .redactor-toolbar { border-radius: var(--ab-radius-sm); border-color: #b8b8c0 !important; }
p.buttons, .buttons { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }

/* ---------- ticket list + thread ---------- */
table.list, #ticketTable {
    width: 100% !important;
    border: 1px solid var(--ab-border) !important;
    border-radius: var(--ab-radius-sm);
    border-collapse: separate !important;
    border-spacing: 0;
    overflow: hidden;
}
table.list th, #ticketTable th {
    background: var(--ab-surface) !important;
    background-image: none !important;
    color: var(--ab-ink) !important;
    font-weight: 600;
    text-align: left;
    padding: 12px !important;
    border: 0 !important;
    border-bottom: 1px solid var(--ab-border) !important;
}
table.list td, #ticketTable td { padding: 12px !important; border: 0 !important; border-bottom: 1px solid var(--ab-border) !important; }
table.list tr:last-child td, #ticketTable tr:last-child td { border-bottom: 0 !important; }
table.list tr:hover td { background: #fafafc; }
.thread-entry .header, .thread-entry.message .header, .thread-entry.response .header {
    border-radius: var(--ab-radius-sm) var(--ab-radius-sm) 0 0;
    background: var(--ab-surface) !important;
    border-color: var(--ab-border) !important;
}
.thread-entry.response .header { background: var(--ab-primary-soft) !important; }
.thread-entry .thread-body { border-color: var(--ab-border) !important; border-radius: 0 0 var(--ab-radius-sm) var(--ab-radius-sm); }
.thread-entry .avatar { border-radius: 50%; }

/* ---------- footer ---------- */
#footer {
    max-width: 1040px;
    margin: 0 auto !important;
    padding: 16px 16px 0 !important;
    background: transparent !important;
    color: var(--ab-ink-muted) !important;
    font-size: 0.875rem;
    text-align: left !important;
    width: auto !important;
}
#footer p { margin: 0; }
#poweredBy {
    display: inline-block !important;
    margin-top: 4px;
    width: auto !important; height: auto !important;
    background: none !important;
    text-indent: 0 !important;
    color: var(--ab-ink-muted) !important;
    font-size: 0.8125rem;
}
#poweredBy img, #poweredBy::before { display: none !important; }
.abrevia-legal {
    max-width: 1040px;
    margin: 8px auto 32px;
    padding: 0 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px 20px;
    font-size: 0.875rem;
}
.abrevia-legal a { color: var(--ab-ink-muted); padding: 10px 0; }
.abrevia-legal a:hover { color: var(--ab-ink); }

/* ---------- small screens ---------- */
@media (max-width: 640px) {
    #content { padding: 20px 16px !important; }
    h1, #landing_page .thread-body h1 { font-size: 1.5rem !important; }
    #landing_page { gap: 24px; }
    #landing_page .sidebar { order: -1; flex-basis: 100%; }
    #header .pull-right { width: 100%; }
    #nav li { flex: 1 1 auto; }
    #nav li a { justify-content: center; padding: 0 10px !important; }
    #ticketForm table, #ticketForm tbody, #ticketForm tr, #ticketForm td,
    form table, form table tbody, form table tr, form table td { display: block; width: 100% !important; }
    input[type=text], input[type=email], input[type=password], input[type=tel], select, textarea { width: 100% !important; }
    input[size="5"] { width: 6em !important; }
    .buttons > *, p.buttons > * { flex: 1 1 100%; }
    table.list, #ticketTable { display: block; overflow-x: auto; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; }
}

@media print {
    .abrevia-legal, #nav, #header .pull-right { display: none !important; }
    #content { border: 0; padding: 0 !important; }
}
