:root {
    --blue: #166b8c;
    --blue-light: #52b3d9;
    --ink: #25313a;
    --muted: #68747d;
    --line: #dce3e7;
    --surface: #ffffff;
    --background: #f3f6f8;
    --danger: #a52a2a;
    --warning: #9a6500;
    --success: #2b7551;
}

* { box-sizing: border-box; }

html { font-family: Arial, Helvetica, sans-serif; color: var(--ink); background: var(--background); }
body { margin: 0; line-height: 1.55; }
a { color: var(--blue); }

.container { width: min(1120px, calc(100% - 32px)); margin-inline: auto; }
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.header-inner { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: flex; align-items: center; gap: 15px; color: #1e3f6d; text-decoration: none; font-size: 1.1rem; font-weight: 700; }
.brand img { display: block; width: 150px; height: 54px; object-fit: contain; object-position: left center; }
.brand span { border-left: 1px solid var(--line); padding-left: 15px; }
.header-nav { display: flex; align-items: center; gap: 20px; }
.header-nav form { margin: 0; }
.link-button { border: 0; padding: 0; background: none; color: var(--blue); text-decoration: underline; cursor: pointer; font: inherit; }
.main-content { min-height: calc(100vh - 144px); padding-block: 36px 60px; }
.site-footer { min-height: 72px; display: flex; align-items: center; background: #e8eef1; color: var(--muted); font-size: .9rem; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 28px; box-shadow: 0 4px 18px rgba(31, 52, 64, .05); margin-bottom: 24px; }
.narrow-card { max-width: 680px; margin-inline: auto; }
.card h1, .card h2 { margin-top: 0; }

.form-grid { display: grid; gap: 20px; }
.form-row { display: grid; gap: 20px; }
.two-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
label { display: grid; gap: 7px; font-weight: 700; }
input, textarea, select { width: 100%; border: 1px solid #b9c5cb; border-radius: 5px; background: #fff; padding: 11px 12px; color: var(--ink); font: inherit; }
textarea { resize: vertical; }
input:focus, textarea:focus, select:focus { outline: 3px solid rgba(82, 179, 217, .25); border-color: var(--blue); }
.button { justify-self: start; border: 0; border-radius: 5px; padding: 12px 20px; background: var(--blue); color: #fff; font: inherit; font-weight: 700; cursor: pointer; }
.button:hover { background: #0e5873; }
.button:disabled { opacity: .55; cursor: not-allowed; }
.button-secondary { background: #e7f1f5; color: var(--blue); border: 1px solid #b8d2dc; }
.button-secondary:hover { background: #d8eaf1; }
.form-hint { color: var(--muted); font-size: .92rem; margin: 0; }
.reseller-fields { border: 1px solid var(--line); border-radius: 7px; padding: 18px; background: #f8fafb; }
.internal-create-options { display: grid; gap: 10px; margin: 0; border: 1px solid #b8d2dc; border-radius: 7px; padding: 18px; background: #eef8fc; }
.internal-create-options legend { padding: 0 6px; color: var(--blue); font-weight: 700; }
.internal-create-options p { margin: 0; }
.radio-label { display: flex; align-items: flex-start; gap: 9px; font-weight: 400; }
.radio-label input { flex: 0 0 auto; width: auto; margin-top: .3em; }
.checkbox-label { display: flex; align-items: flex-start; gap: 9px; font-weight: 400; }
.checkbox-label input { flex: 0 0 auto; width: auto; margin-top: .3em; }
.reseller-privacy-confirmation { padding: 12px 13px; border: 1px solid #b8d2dc; border-radius: 6px; background: #eef8fc; }
.reseller-privacy-confirmation a { color: var(--blue); }
.customer-detail-warning { border-left-color: var(--warning); background: #fff8e8; }
.confirmation-warning { color: var(--danger); font-weight: 700; }
[hidden] { display: none !important; }
.honeypot { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; overflow: hidden; }

.alert { border-radius: 6px; padding: 14px 16px; margin-bottom: 20px; }
.alert-error { background: #fff0f0; border: 1px solid #e7b7b7; color: #812020; }
.alert-success { background: #effaf4; border: 1px solid #b8ddc8; color: #205d3e; }
.alert-info { background: #eff7fa; border: 1px solid #bfdce7; }
.ticket-number { color: var(--blue); font-size: 1.6rem; font-weight: 700; letter-spacing: .04em; }

.page-heading, .ticket-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.page-heading h1, .ticket-heading h1 { margin: 0; }
.page-heading p, .ticket-heading p { margin: 4px 0; }
.eyebrow { color: var(--muted); font-size: .82rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.language-switch { display: flex; justify-content: flex-end; gap: 4px; margin-bottom: 12px; }
.language-switch a { padding: 4px 9px; border-radius: 4px; text-decoration: none; font-size: .85rem; }
.language-switch a[aria-current="page"] { background: var(--blue); color: #fff; font-weight: 700; }
.ticket-badges { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }

.status { display: inline-flex; align-items: center; min-height: 29px; border-radius: 999px; padding: 4px 11px; background: #eaf0f3; color: #3f4c54; font-size: .84rem; font-weight: 700; white-space: nowrap; }
.status-in_progress { background: #e7f5fb; color: #095e80; }
.status-waiting_customer { background: #fff4d9; color: #775000; }
.status-resolved { background: #e6f6ed; color: #246946; }
.status-closed { background: #eceff1; color: #536068; }
.priority { display: inline-flex; align-items: center; min-height: 29px; border-radius: 5px; padding: 4px 10px; background: #edf1f3; color: #46535b; font-size: .82rem; font-weight: 700; white-space: nowrap; }
.priority-high { background: #fff0d8; color: #7b4d00; }
.priority-critical { background: #a52a2a; color: #fff; }

.timeline { display: grid; gap: 14px; margin-bottom: 28px; }
.message { border: 1px solid var(--line); border-radius: 8px; background: var(--surface); padding: 18px; }
.message header { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: baseline; margin-bottom: 10px; }
.message header time { margin-left: auto; color: var(--muted); font-size: .86rem; }
.message header span { color: var(--muted); font-size: .82rem; }
.message-customer { border-left: 5px solid var(--blue-light); }
.message-staff.message-external { border-left: 5px solid var(--success); }
.message-internal { border-left: 5px solid #d49a25; background: #fffaf0; }
.attachments { margin: 14px 0 0; padding-left: 22px; }
.attachments small, .muted { color: var(--muted); }
.privacy-notice { margin: 4px 0 0; padding: 12px 14px; border-left: 3px solid var(--blue); background: #f3f7fb; color: var(--ink); }
.privacy-notice a, .site-footer a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.block { display: block; }
.customer-detail { padding: 7px 10px; border-left: 4px solid var(--blue-light); background: #eef8fc; }
.external-label { border-left: 5px solid var(--success); padding-left: 14px; }
.internal-label { border-left: 5px solid #d49a25; padding-left: 14px; }
.upload-manager { display: grid; gap: 9px; }
.upload-label { margin: 0; font-weight: 700; }
.upload-enhanced-controls { display: none; gap: 10px; justify-items: start; }
.upload-manager.is-enhanced > input[data-attachments] { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.upload-manager.is-enhanced .upload-enhanced-controls { display: grid; }
.upload-summary { margin: 0; color: var(--muted); font-size: .9rem; }
.upload-file-list { width: min(100%, 680px); display: grid; gap: 7px; margin: 0; padding: 0; list-style: none; }
.upload-file-list li { display: flex; align-items: center; justify-content: space-between; gap: 16px; border: 1px solid var(--line); border-radius: 6px; padding: 9px 10px 9px 12px; background: #f8fafb; }
.upload-file-list li > span { min-width: 0; display: grid; }
.upload-file-list strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .94rem; }
.upload-file-list small { color: var(--muted); }
.upload-remove { flex: 0 0 auto; display: grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: 50%; background: #fff0f0; color: var(--danger); font: inherit; font-size: 1.35rem; line-height: 1; cursor: pointer; }
.upload-remove:hover, .upload-remove:focus-visible { background: #f7dada; }
.rule-list { padding-left: 22px; }
.rule-list li + li { margin-top: 8px; }
.maintenance-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 0 0 22px; }
.maintenance-stats div { border: 1px solid var(--line); border-radius: 6px; padding: 13px; background: #f8fafb; }
.maintenance-stats dt { color: var(--muted); font-size: .86rem; }
.maintenance-stats dd { margin: 4px 0 0; font-size: 1.1rem; font-weight: 700; }
.table-heading { padding: 20px 16px 4px; }
.maintenance-table { min-width: 650px; }

.ticket-filters { display: grid; grid-template-columns: minmax(220px, 2fr) repeat(3, minmax(165px, 1fr)); gap: 20px; padding-block: 18px; }
.filter-checkbox { grid-column: 1 / -1; display: flex; align-items: center; gap: 9px; font-weight: 400; }
.filter-checkbox input { flex: 0 0 auto; width: auto; }
.table-wrapper { overflow-x: auto; padding: 0; }
.ticket-table { width: 100%; border-collapse: collapse; min-width: 850px; }
.ticket-table th, .ticket-table td { padding: 14px 16px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.ticket-table th { background: #edf3f6; color: #3b4850; font-size: .86rem; }
.ticket-table tr:last-child td { border-bottom: 0; }
.unread-row { background: #f1f9fc; font-weight: 700; }
.unread-dot { display: inline-block; width: 9px; height: 9px; margin-right: 6px; border-radius: 50%; background: var(--blue-light); }
.action-column { width: 54px; text-align: center !important; }
.action-column form { margin: 0; }
.icon-button { display: inline-grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: 5px; background: transparent; color: var(--muted); cursor: pointer; }
.icon-button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-button-danger:hover, .icon-button-danger:focus-visible { background: #fff0f0; color: var(--danger); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (max-width: 720px) {
    .container { width: min(100% - 20px, 1120px); }
    .main-content { padding-top: 22px; }
    .card { padding: 20px; }
    .two-columns, .ticket-filters, .maintenance-stats { grid-template-columns: 1fr; }
    .page-heading, .ticket-heading { align-items: stretch; flex-direction: column; }
    .status { align-self: flex-start; }
    .ticket-badges { justify-content: flex-start; }
    .header-inner { min-height: 62px; }
    .brand img { width: 118px; height: 44px; }
    .brand { gap: 10px; }
    .brand span { padding-left: 10px; }
}
