@font-face {
    font-family: Roboto;
    src: url('/fonts/roboto_5.1.0/webfonts/roboto-latin-400-normal.woff2') format('woff2');
    font-weight: 400;
    font-display: swap;
}

@font-face {
    font-family: Roboto;
    src: url('/fonts/roboto_5.1.0/webfonts/roboto-latin-700-normal.woff2') format('woff2');
    font-weight: 700;
    font-display: swap;
}

:root {
    --blue: #0066cc;
    --blue-dark: #004f9f;
    --ink: #333;
    --muted: #526071;
    --line: #d9e1eb;
    --paper: #fff;
    --background: #f1f5fa;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    background: var(--background);
    color: var(--ink);
    font: 1rem/1.55 Roboto, Arial, sans-serif;
}

.entry { background: #233345; }

a { color: var(--blue-dark); text-underline-offset: .18em; }
a:hover { color: var(--blue); }
:focus-visible { outline: 3px solid #0066cc; outline-offset: 3px; }

.skip, .sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

.skip:focus {
    top: .5rem;
    left: .5rem;
    z-index: 3;
    width: auto;
    height: auto;
    padding: .5rem 1rem;
    background: var(--paper);
    clip-path: none;
}

.brand-header {
    position: relative;
    display: flex;
    justify-content: center;
    padding: .5rem 1rem;
    background: var(--paper);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: .65rem;
    color: var(--ink);
    font-size: clamp(2rem, 6vw, 3.125rem);
    font-weight: 700;
    line-height: 1;
    text-decoration: none;
}

.brand:hover { color: var(--ink); }
.brand-blue { color: var(--blue); }
.brand img { width: clamp(3rem, 10vw, 3.875rem); height: auto; aspect-ratio: 1; object-fit: contain; }

.background-video {
    position: fixed;
    z-index: -1;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.entry { isolation: isolate; }

.navigation { background: var(--ink); }
.navigation-inner, .content { width: min(100% - 2rem, 72rem); margin: 0 auto; }

.navigation-inner, .navigation-links {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .25rem .5rem;
}

.navigation-inner { padding: .25rem 0; }
.navigation-links a, .nav-button {
    display: block;
    padding: .55rem .65rem;
    border: 0;
    border-radius: .25rem;
    background: none;
    color: white;
    font: inherit;
    text-decoration: none;
    cursor: pointer;
}

.navigation-links a:hover, .nav-button:hover { background: #484848; }
.navigation-links a[aria-current] { background: lightblue; color: var(--ink); }
.navigation-count {
    display: inline-block;
    min-width: 1.5em;
    margin-inline-start: .3rem;
    padding: .1em .35em;
    border-radius: 1em;
    background: #e3f0fd;
    color: var(--blue-dark);
    font-size: .8em;
    font-weight: 700;
    line-height: 1.25;
    text-align: center;
}
.navigation-links a[aria-current] .navigation-count { background: var(--blue-dark); color: white; }
.navigation :focus-visible { outline-color: lightblue; }
.navigation .account { display: inline-flex; align-items: center; gap: .55rem; min-width: 0; overflow-wrap: anywhere; }
.navigation .account .avatar { width: 1.65rem; height: 1.65rem; }

.content { padding: clamp(1.25rem, 4vw, 3rem) 0 4rem; }
.entry .content { width: min(100% - 2rem, 30rem); padding-top: clamp(2.25rem, 11vh, 7rem); }

h1, h2, p, ul, dl { margin: 0; }
h1 { margin-bottom: 1.15rem; font-size: clamp(1.65rem, 4vw, 2.35rem); line-height: 1.15; overflow-wrap: anywhere; }
h2 { margin-bottom: .9rem; font-size: 1.25rem; line-height: 1.3; }
p + p { margin-top: .6rem; }

.panel {
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: .9rem;
    background: var(--paper);
    box-shadow: 0 3px 12px rgb(20 53 85 / 5%);
}

.auth-panel, .form-panel, .conversation, .ticket-details, .compact { padding: clamp(1.15rem, 4vw, 2rem); }
.auth-panel { background: rgb(255 255 255 / 96%); }
.compact { max-width: 30rem; }
.compact p + a { display: inline-block; margin-top: 1rem; }
.form-panel { max-width: 49rem; }
.form-panel.compact { max-width: 30rem; }
.intro, .form-panel > p { margin-bottom: 1.2rem; color: var(--muted); }

.fields { display: grid; gap: 1rem; }
.fields > .button { justify-self: start; }
.fields label { display: grid; gap: .4rem; font-weight: 700; min-width: 0; }
.field-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }

input, select, textarea, button { font: inherit; }
input:not([type='hidden']), select, textarea {
    width: 100%;
    min-width: 0;
    min-height: 2.65rem;
    padding: .55rem .7rem;
    border: 1px solid #a7b6c7;
    border-radius: .35rem;
    background: white;
    color: var(--ink);
    font-weight: 400;
}

textarea { resize: vertical; }
.hint { margin: -.55rem 0 0; color: var(--muted); font-size: .875rem; }
.form-panel > .deletion-contact { margin: .75rem 0 0; }

.button {
    display: inline-flex;
    min-height: 2.65rem;
    align-items: center;
    justify-content: center;
    padding: .5rem .85rem;
    border: 1px solid transparent;
    border-radius: .35rem;
    background: var(--blue);
    color: white;
    font-weight: 700;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
}

.button:hover { background: var(--blue-dark); color: white; }
.button.secondary { border-color: #a7b6c7; background: white; color: var(--blue-dark); }
.button.secondary:hover { border-color: var(--blue); background: #eaf4ff; }

.page-heading { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .8rem; margin-bottom: 1rem; }
.page-heading h1 { margin: 0; }
.filters { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .75rem; padding: .9rem 1rem; border-bottom: 1px solid var(--line); }
.status-tabs { display: flex; flex-wrap: wrap; gap: .35rem; }
.status-tabs a { padding: .5rem .65rem; border-radius: .35rem; color: var(--muted); font-weight: 700; text-decoration: none; }
.status-tabs a:hover, .status-tabs a[aria-current] { background: #e6f1fd; color: var(--blue-dark); }
.filter-form { display: flex; align-items: end; flex-wrap: wrap; min-width: 0; max-width: 100%; gap: .5rem; }
.filter-form .lookup-field { width: clamp(10rem, 15vw, 14rem); }
.date-filters { display: flex; flex-wrap: wrap; gap: .5rem; min-width: 0; margin: 0; padding: 0; border: 0; }
.date-filters legend { margin-bottom: .2rem; padding: 0; color: var(--muted); font-size: .875rem; }
.date-filters label { display: flex; align-items: center; gap: .35rem; }
.date-filters input { width: auto; max-width: 100%; }
.lookup-field { display: grid; gap: .4rem; min-width: 0; }
.lookup-field select[hidden] { display: none; }
.lookup-control { position: relative; min-width: 0; }
.lookup-control > input { cursor: text; }
.lookup-panel {
    position: absolute;
    z-index: 5;
    inset-inline: 0;
    top: calc(100% + .25rem);
    overflow: auto;
    max-height: min(16rem, 40vh);
    border: 1px solid #a7b6c7;
    border-radius: .35rem;
    background: white;
    box-shadow: 0 5px 16px rgb(20 53 85 / 16%);
}
.lookup-panel ul { padding: .2rem 0; list-style: none; }
.lookup-panel li { padding: .45rem .65rem; cursor: pointer; overflow-wrap: anywhere; }
.lookup-panel li:hover, .lookup-panel .is-highlighted { background: #e6f1fd; color: var(--blue-dark); }
.lookup-panel li[aria-selected='true'] { font-weight: 700; }
.lookup-note, .lookup-fallback { padding: .5rem .65rem; color: var(--muted); font-size: .875rem; }
.customer-filters { padding: 1rem; border-bottom: 1px solid var(--line); }
.customer-filter-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .8rem; }
.customer-filter-actions, .customer-pagination { display: flex; align-items: center; flex-wrap: wrap; gap: .75rem; }
.customer-pagination { padding: .85rem 1rem; border-top: 1px solid var(--line); }
.result-count { padding: .6rem 1rem; color: var(--muted); font-size: .875rem; }
.records, .attachments { padding: 0; list-style: none; }
.records li + li { border-top: 1px solid var(--line); }

.ticket-row, .customer-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(7.6rem, auto);
    gap: .8rem;
    align-items: center;
    padding: .85rem 1rem;
}

.ticket-row { color: var(--ink); text-decoration: none; }
.ticket-row:hover { background: #f4f9ff; color: var(--blue-dark); }
.ticket-subject { display: grid; gap: .12rem; overflow-wrap: anywhere; }
.ticket-date { text-align: right; }
.metadata, .support-role { color: var(--muted); font-size: .875rem; }
.status { display: inline-block; width: fit-content; max-width: 100%; padding: .2rem .5rem; border-radius: .3rem; font-size: .875rem; font-weight: 700; }
.status.open { background: #e5f2fe; color: #004982; }
.status.in_progress { background: #e7f4ed; color: #185b39; }
.status.waiting { background: #fff0cc; color: #704606; }
.status.closed { background: #e9edf1; color: #465563; }
.empty { padding: 1rem; color: var(--muted); }
.back { display: inline-block; margin-bottom: .8rem; }
.detail-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(13rem, 16rem); align-items: start; gap: 1rem; }
.conversation > header .metadata { margin-bottom: .45rem; }
.message { padding: 1rem 0; border-top: 1px solid var(--line); }
.message-header { display: flex; flex-wrap: wrap; align-items: baseline; gap: .35rem .65rem; }
.message-header .metadata { margin-left: auto; }
.avatar { display: inline-flex; flex: 0 0 auto; width: 36px; height: 36px; border-radius: 50%; object-fit: cover; align-items: center; justify-content: center; align-self: center; }
.avatar-placeholder { background: #e5f2fe; color: var(--blue-dark); font-size: .9rem; font-weight: 700; text-transform: uppercase; }
.message-body { margin-top: .5rem; overflow-wrap: anywhere; white-space: pre-wrap; }
.support-role { color: var(--blue-dark); }
.attachments { display: grid; gap: .45rem; margin-top: .7rem; }
.attachments li { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; padding: .45rem .65rem; border: 1px solid var(--line); border-radius: .35rem; }
.attachments a { min-width: 0; overflow-wrap: anywhere; }
.attachments .metadata { white-space: nowrap; }
.attachments .image-attachment { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
.attachment-image { grid-column: 1 / -1; width: fit-content; max-width: 100%; }
.attachment-image img { display: block; max-width: 100%; max-height: 25rem; border: 1px solid var(--line); border-radius: .35rem; object-fit: contain; }
.message-with-images .attachment-image { display: inline-block; margin: .35rem .15rem; vertical-align: middle; }
.ticket-editor { min-height: 8rem; padding: .55rem .7rem; border: 1px solid #a7b6c7; border-radius: .35rem; background: white; font-weight: 400; white-space: pre-wrap; overflow-wrap: anywhere; }
.ticket-editor-large { min-height: 11rem; }
.ticket-editor:empty::before { color: var(--muted); content: attr(data-placeholder); pointer-events: none; }
.ticket-editor .inline-screenshot { display: inline-flex; flex-wrap: wrap; align-items: flex-start; gap: .4rem; max-width: 100%; padding: .25rem; border: 1px solid var(--line); border-radius: .35rem; vertical-align: middle; }
.inline-screenshot img { display: block; max-width: min(20rem, 100%); max-height: 13rem; object-fit: contain; }
.inline-screenshot button { min-height: 2rem; padding: .2rem .45rem; font-size: .84rem; }
.ticket-uploads { min-width: 0; gap: .65rem; }
.ticket-uploads .hint { margin: 0; }
.ticket-uploads [hidden] { display: none; }
.upload-previews { display: grid; gap: .45rem; padding: 0; list-style: none; }
.upload-previews li { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; min-width: 0; padding: .5rem; border: 1px solid var(--line); border-radius: .35rem; }
.upload-previews img { width: 6rem; height: 4rem; object-fit: contain; }
.upload-previews span { flex: 1 1 9rem; min-width: 0; overflow-wrap: anywhere; }
.upload-previews button { min-height: 2.2rem; padding: .3rem .55rem; }
.upload-status { color: var(--blue-dark); }
.reply { border-top: 1px solid var(--line); padding-top: 1rem; }
.edit-ticket { margin-bottom: 1rem; }
.edit-ticket summary, .row-detail summary { color: var(--blue-dark); cursor: pointer; }
.edit-ticket .fields, .row-detail .fields { margin-top: .75rem; }
.ticket-details dl { display: grid; gap: .25rem; font-size: .95rem; }
.ticket-details dt { color: var(--muted); }
.ticket-details dd { margin: 0 0 .45rem; overflow-wrap: anywhere; }
.ticket-details form { margin-top: .75rem; }
.ticket-files { margin-top: 1.15rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.ticket-files ul { padding: 0; list-style: none; }
.ticket-files li { display: grid; gap: .2rem; padding: .55rem 0; overflow-wrap: anywhere; }
.ticket-files li + li { border-top: 1px solid var(--line); }
.customer-list { margin-top: 1rem; }
.row-actions { display: flex; justify-content: end; flex-wrap: wrap; gap: .5rem; }
.row-actions .button { font-size: .9rem; }
.row-detail { max-width: 17rem; font-size: .875rem; }
.row-detail[open] { flex-basis: 100%; }
.company-row { padding: .85rem 1rem; }
.company-row-header { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: .6rem 1rem; cursor: pointer; list-style: none; }
.company-row-header::-webkit-details-marker { display: none; }
.company-edit-label { display: inline-flex; align-items: center; gap: .4rem; color: var(--blue-dark); font-size: .9rem; }
.company-edit-label::before { content: ''; width: .4rem; height: .4rem; border-inline-end: 2px solid; border-block-end: 2px solid; transform: translateY(-.1rem) rotate(45deg); }
.company-details[open] .company-edit-label::before { transform: translateY(.1rem) rotate(225deg); }
.company-edit-form { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.profile-heading .avatar { width: 54px; height: 54px; }
.profile-photo { display: grid; justify-items: center; gap: .35rem; padding: 0; border: 0; background: none; color: var(--blue-dark); cursor: pointer; }
.profile-photo:disabled { cursor: default; }
.profile-photo .avatar { width: clamp(4rem, 14vw, 5.25rem); height: auto; aspect-ratio: 1; }
.profile-photo-label { font-size: .875rem; font-weight: 700; }
.profile-photo:disabled .profile-photo-label { display: none; }
.profile-avatar-tools { display: flex; flex-wrap: wrap; align-items: center; gap: .65rem; margin: 0 0 1rem; }
.profile-avatar-tools .hint { margin: 0; }
[data-profile-avatar] [hidden] { display: none; }
.avatar-editor { width: min(100% - 2rem, 28rem); max-height: calc(100% - 2rem); overflow: auto; padding: 1.25rem; border: 1px solid var(--line); border-radius: .85rem; background: var(--paper); color: var(--ink); }
.avatar-editor::backdrop { background: rgb(17 31 49 / 65%); }
.avatar-crop { display: block; width: min(100%, 16rem); height: auto; aspect-ratio: 1; margin: 1rem auto; border-radius: 50%; background: var(--background); cursor: grab; touch-action: none; }
.avatar-crop.is-dragging { cursor: grabbing; }
.avatar-zoom { display: grid; gap: .35rem; margin: 1rem 0; font-weight: 700; }
.avatar-zoom input[type='range'] { min-height: 2rem; padding: 0; border: 0; accent-color: var(--blue); }
.avatar-editor-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .55rem; }
.profile-password { margin-top: 1rem; }
.fields .check-field { display: flex; align-items: center; }
.fields input[type='checkbox'] { width: 1.1rem; min-height: 0; }
.button.danger { background: #962f27; }
.button.danger:hover { background: #762219; }
.alert { margin: 0 0 1rem; padding: .75rem 1rem; border: 1px solid; border-radius: .4rem; overflow-wrap: anywhere; }
.alert.error { border-color: #bd7c76; background: #fff2f1; color: #781e17; }
.alert.warning { border-color: #b78c37; background: #fff6dd; color: #644105; }
.alert.success { border-color: #79a88e; background: #e9f7ef; color: #205633; }

@media (max-width: 640px) {
    .detail-layout, .field-pair { grid-template-columns: minmax(0, 1fr); }
    .customer-filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .filter-form .lookup-field { width: min(100%, 14rem); }
    .ticket-row { grid-template-columns: minmax(0, 1fr) auto; }
    .ticket-date { grid-column: 1 / -1; text-align: left; }
    .customer-row { grid-template-columns: minmax(0, 1fr) auto; }
    .row-actions { grid-column: 1 / -1; justify-content: start; }
    .company-row-header { grid-template-columns: minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
    .background-video { display: none; }
}
