/*
  Shared UI primitives for both areas. Page layout lives in each component's scoped CSS; anything
  more than one page uses (buttons, cards, fields, segmented tabs, badges) lives here so the two
  areas cannot drift apart.
*/

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* Buttons */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 20px;
    border: 0;
    border-radius: var(--radius-xs);
    font: inherit;
    font-size: 15px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
}

.btn:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
}

.btn-primary {
    background: var(--brand);
    color: #ffffff;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .14);
}

.btn-primary:hover {
    background: var(--brand-strong);
    color: #ffffff;
}

.btn-primary:disabled,
.btn-primary[aria-disabled="true"] {
    background: var(--disabled);
    cursor: not-allowed;
}

.btn-secondary {
    background: var(--surface);
    color: var(--ink);
    box-shadow: inset 0 0 0 1px var(--hairline);
}

.btn-secondary:hover {
    background: var(--surface-2);
    color: var(--ink);
}

.btn-soft {
    background: #f1efec;
    color: var(--ink);
}

.btn-soft:hover {
    background: var(--window-2);
    color: var(--ink);
}

.btn-quiet {
    min-height: 36px;
    padding: 0 8px;
    background: transparent;
    color: var(--muted);
    font-size: 13px;
    font-weight: 400;
}

.btn-quiet:hover {
    color: var(--ink);
}

.btn-sm {
    min-height: 40px;
    padding: 0 16px;
    font-size: 14px;
}

.btn-round {
    border-radius: var(--radius);
}

/* Customer cards: white, hairline border. */

.card {
    background: var(--surface);
    border: 1px solid var(--hairline);
    border-radius: var(--radius);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.card > h2,
.card-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.card-lead {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
    color: var(--muted);
}

/* Manage panels: white, borderless, soft shadow on the warm ground. */

.panel {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    min-width: 0;
}

.panel-title {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
}

/* Form fields */

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.field-label {
    font-size: 14px;
    font-weight: 500;
}

.field-optional {
    font-weight: 400;
    color: var(--muted);
}

.field-hint {
    font-size: 13px;
    color: var(--muted);
}

.field-error,
.field .validation-message {
    font-size: 13px;
    color: var(--danger);
}

.input {
    width: 100%;
    min-height: 42px;
    padding: 0 12px;
    border: 1px solid var(--hairline);
    border-radius: var(--radius-xs);
    background: var(--surface);
    font: inherit;
    font-size: 15px;
    color: var(--ink);
}

textarea.input {
    padding: 10px 12px;
    line-height: 1.5;
    resize: vertical;
}

.input:focus {
    outline: 2px solid var(--brand);
    outline-offset: -1px;
    border-color: transparent;
}

.input.invalid {
    outline: 1.5px solid var(--danger);
}

.input.valid.modified:not([type=checkbox]) {
    outline: none;
}

/* The manage area uses filled fields instead of outlined ones. */
.input-filled {
    border: 0;
    border-radius: var(--radius);
    background: var(--surface-3);
    min-height: 48px;
    padding: 0 16px;
}

textarea.input-filled {
    padding: 14px 16px;
    font-size: 14px;
}

.search {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 42px;
    padding: 0 12px;
    border: 1px solid var(--hairline);
    border-radius: var(--radius-xs);
    background: var(--surface);
    color: var(--muted);
}

.search:focus-within {
    outline: 2px solid var(--brand);
    outline-offset: -1px;
}

.search input {
    flex: 1;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    font: inherit;
    font-size: 15px;
    color: var(--ink);
}

/* Segmented control (period and status tabs) */

.segmented {
    display: flex;
    flex-wrap: wrap;
    padding: 3px;
    border-radius: var(--radius);
    background: var(--window-2);
}

.segmented button {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 32px;
    padding: 0 12px;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    color: var(--ink);
    cursor: pointer;
}

.segmented button[aria-selected="true"] {
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.segmented .count {
    color: var(--muted);
}

/* Status badge and dot */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

.dot {
    flex: 0 0 8px;
    width: 8px;
    height: 8px;
    border-radius: 999px;
}

.status-used { --status-dot: var(--status-used); --status-ink: var(--status-used-ink); --status-tint: var(--status-used-tint); }
.status-visited { --status-dot: var(--status-visited); --status-ink: var(--status-visited-ink); --status-tint: var(--status-visited-tint); }
.status-notused { --status-dot: var(--status-notused); --status-ink: var(--status-notused-ink); --status-tint: var(--status-notused-tint); }
.status-expired { --status-dot: var(--status-expired); --status-ink: var(--status-expired-ink); --status-tint: var(--status-expired-tint); }
.status-revoked { --status-dot: var(--status-revoked); --status-ink: var(--status-revoked-ink); --status-tint: var(--status-revoked-tint); }

.badge[class*="status-"] {
    color: var(--status-ink);
    background: var(--status-tint);
}

.dot[class*="status-"] {
    background: var(--status-dot);
}

/* Changelog change kinds borrow the status triples so the page stays in the same palette. */

.change-new { --change-dot: var(--status-used); --change-ink: var(--status-used-ink); --change-tint: var(--status-used-tint); }
.change-improvement { --change-dot: var(--status-notused); --change-ink: var(--status-notused-ink); --change-tint: var(--status-notused-tint); }
.change-fix { --change-dot: var(--status-visited); --change-ink: var(--status-visited-ink); --change-tint: var(--status-visited-tint); }

.dot[class*="change-"] {
    flex-basis: 7px;
    width: 7px;
    height: 7px;
    background: var(--change-dot);
}

/* Brand mark ("F" square) */

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 28px;
    height: 28px;
    border-radius: 7px;
    background: var(--brand);
    color: #ffffff;
    font-weight: 600;
    font-size: 14px;
}

/* File drop zone and file rows (complaint form and the receipt page) */

.dropzone {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 24px 16px;
    border: 1px dashed var(--dashed);
    border-radius: 10px;
    background: #fafaf9;
    text-align: center;
    cursor: pointer;
}

.dropzone:focus-within,
.dropzone:hover {
    border-color: var(--brand);
}

.dropzone-title {
    font-size: 14px;
    font-weight: 500;
}

.dropzone-title em {
    font-style: normal;
    color: var(--brand);
}

.dropzone-hint {
    font-size: 13px;
    color: var(--muted);
}

/* The real input covers the whole zone, so clicking anywhere or dropping files onto it works. */
.dropzone input[type=file] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.file-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid var(--hairline);
    border-radius: var(--radius-xs);
    font-size: 14px;
}

.file-row-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-row-size {
    color: var(--muted);
}

/* ValidationMessage always renders its own class, so it is styled here rather than through .field-error. */
.validation-message {
    font-size: 13px;
    color: var(--danger);
}
