/* Personal and company cabinets, orders, checkout and the support inbox.
   One small design language on top of Bootstrap: cards, tabs, choice tiles,
   status badges and a custom dropdown (account.js). */

.ac {
    --ac-ink: #1a1a1a;
    --ac-muted: #6b6b6b;
    --ac-line: #ebebeb;
    --ac-soft: #f5f5f5;
    --ac-red: #e60023;
    --ac-radius: 16px;
    color: var(--ac-ink);
    max-width: 1180px;
    margin: 0 auto;
    padding: 28px 16px 56px;
}

.ac--narrow { max-width: 860px; }
.ac [hidden] { display: none !important; }

.ac a:not(.btn):not(.ac-tab):not(.ac-plain) {
    color: var(--ac-ink);
    text-decoration: underline;
    text-decoration-color: rgba(26, 26, 26, .25);
    text-underline-offset: 3px;
}

.ac a:not(.btn):not(.ac-tab):not(.ac-plain):hover { text-decoration-color: currentColor; }
.ac a.ac-plain { color: inherit; text-decoration: none; }
.ac a.ac-plain:hover { text-decoration: underline; text-underline-offset: 3px; }

.ac .btn { white-space: nowrap; border-radius: 10px; font-weight: 500; }
.ac .btn-sm { border-radius: 8px; }
.ac .btn-dark { background: var(--ac-ink); border-color: var(--ac-ink); }
.ac .btn-outline-dark { border-color: #d4d4d4; color: var(--ac-ink); }
.ac .btn-outline-dark:hover { background: var(--ac-soft); border-color: #c4c4c4; color: var(--ac-ink); }
.ac .btn-red { background: var(--ac-red); border-color: var(--ac-red); color: #fff; }
.ac .btn-red:hover { background: #c9001f; border-color: #c9001f; color: #fff; }
.ac .btn-ghost-danger { background: none; border: 0; color: var(--ac-muted); padding: 4px 8px; font-weight: 500; }
.ac .btn-ghost-danger:hover { color: var(--ac-red); }
.ac .btn-icon { width: 36px; height: 36px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }

.ac .form-control, .ac .form-select { border-radius: 10px; border-color: #dcdcdc; min-height: 42px; }
.ac .form-control:focus, .ac .form-select:focus { border-color: var(--ac-ink); box-shadow: 0 0 0 3px rgba(26, 26, 26, .08); }
.ac .form-label { font-weight: 600; font-size: .9rem; margin-bottom: 6px; }
.ac .form-text, .ac-hint { color: var(--ac-muted); font-size: .85rem; }
.ac .errorlist, .ac-error { color: var(--ac-red); font-size: .85rem; list-style: none; padding: 0; margin: 4px 0 0; }

/* page head */
.ac-back { display: inline-flex; align-items: center; gap: 6px; font-size: .9rem; color: var(--ac-muted) !important; text-decoration: none !important; margin-bottom: 10px; }
.ac-back:hover { color: var(--ac-ink) !important; }
.ac-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.ac-head h1 { font-size: 1.85rem; font-weight: 700; letter-spacing: -.02em; margin: 0; }
.ac-head p { color: var(--ac-muted); margin: 6px 0 0; }
.ac-head-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.ac-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; color: var(--ac-muted); font-size: .92rem; margin-top: 8px; }

/* cards and layout */
.ac-card { background: #fff; border: 1px solid var(--ac-line); border-radius: var(--ac-radius); padding: 24px; }
.ac-card + .ac-card { margin-top: 16px; }
.ac-card-title { font-size: 1.1rem; font-weight: 700; margin: 0 0 4px; }
.ac-card-sub { color: var(--ac-muted); font-size: .9rem; margin: 0 0 18px; }
.ac-card-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.ac-card-head .ac-card-sub { margin: 0; }
.ac-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start; }
.ac-aside { position: sticky; top: 16px; }
.ac-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 24px; }
.ac-stat { background: var(--ac-soft); border-radius: var(--ac-radius); padding: 18px 20px; display: flex; flex-direction: column; gap: 4px; }
.ac-stat-label { color: var(--ac-muted); font-size: .85rem; }
.ac-stat-value { font-size: 1.6rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; }
.ac-stat-foot { margin-top: auto; padding-top: 8px; font-size: .85rem; color: var(--ac-muted); }
.ac-money { font-size: 2rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }

/* tabs */
.ac-tabs { display: flex; gap: 4px; padding: 4px; background: var(--ac-soft); border-radius: 999px; width: max-content; max-width: 100%; overflow-x: auto; scrollbar-width: none; margin-bottom: 20px; }
.ac-tabs::-webkit-scrollbar { display: none; }
.ac-tab { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 999px; color: var(--ac-muted); text-decoration: none; font-weight: 600; font-size: .92rem; white-space: nowrap; }
.ac-tab:hover { color: var(--ac-ink); }
.ac-tab.is-active { background: #fff; color: var(--ac-ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .1); }
.ac-count { display: inline-flex; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--ac-ink); color: #fff; font-size: .72rem; align-items: center; justify-content: center; }
.ac-tab:not(.is-active) .ac-count { background: #d8d8d8; color: var(--ac-ink); }

/* list rows */
.ac-list { display: flex; flex-direction: column; }
.ac-row { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-top: 1px solid var(--ac-line); }
.ac-row:first-child { border-top: 0; padding-top: 0; }
.ac-row:last-child { padding-bottom: 0; }
.ac-row-main { flex: 1; min-width: 0; }
.ac-row-title { font-weight: 600; }
.ac-row-sub { color: var(--ac-muted); font-size: .88rem; overflow: hidden; text-overflow: ellipsis; }
.ac-row-side { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
a.ac-row { color: inherit; text-decoration: none; }
a.ac-row:hover .ac-row-title { text-decoration: underline; text-underline-offset: 3px; }
.ac-avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--ac-soft); color: var(--ac-ink); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: .9rem; flex-shrink: 0; text-transform: uppercase; }
.ac-thumb { width: 72px; height: 72px; border-radius: 12px; object-fit: cover; background: var(--ac-soft); flex-shrink: 0; }

/* badges */
.ac-badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 600; background: var(--ac-soft); color: var(--ac-muted); white-space: nowrap; }
.ac-badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.ac-badge--plain::before { display: none; }
.ac-badge--wait { background: #fff3df; color: #9a5b00; }
.ac-badge--ok { background: #e6f5ec; color: #1c7a3d; }
.ac-badge--new { background: #fde8ec; color: #c4001e; }
.ac-badge--dark { background: var(--ac-ink); color: #fff; }

/* choice tiles (radio cards) */
.ac-choices { display: grid; gap: 10px; }
.ac-choices--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ac-choices--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ac-choice { position: relative; display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border: 1.5px solid var(--ac-line); border-radius: 14px; cursor: pointer; background: #fff; margin: 0; transition: border-color .15s, background .15s; }
.ac-choice:hover { border-color: #cfcfcf; }
.ac-choice input { position: absolute; opacity: 0; pointer-events: none; }
.ac-choice-mark { width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid #bdbdbd; flex-shrink: 0; margin-top: 2px; display: inline-flex; align-items: center; justify-content: center; }
.ac-choice-mark::after { content: ''; width: 10px; height: 10px; border-radius: 50%; background: transparent; }
.ac-choice:has(input:checked) { border-color: var(--ac-ink); background: #fafafa; }
.ac-choice:has(input:checked) .ac-choice-mark { border-color: var(--ac-ink); }
.ac-choice:has(input:checked) .ac-choice-mark::after { background: var(--ac-ink); }
.ac-choice:has(input:focus-visible) { box-shadow: 0 0 0 3px rgba(26, 26, 26, .15); }
.ac-choice:has(input:disabled) { opacity: .5; cursor: not-allowed; }
.ac-choice-body { min-width: 0; flex: 1; }
.ac-choice-title { font-weight: 600; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 10px; }
.ac-choice-text { color: var(--ac-muted); font-size: .86rem; margin-top: 2px; }
.ac-choice[hidden] { display: none; }

/* steps (checkout) */
.ac-step { display: flex; gap: 14px; }
.ac-step + .ac-step { margin-top: 28px; padding-top: 28px; border-top: 1px solid var(--ac-line); }
.ac-step-num { width: 28px; height: 28px; border-radius: 50%; background: var(--ac-ink); color: #fff; font-weight: 700; font-size: .85rem; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.ac-step-body { flex: 1; min-width: 0; }
.ac-step-title { font-weight: 700; font-size: 1.05rem; margin: 2px 0 14px; }

/* key-value */
.ac-kv { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 10px 16px; margin: 0; font-size: .93rem; }
.ac-kv dt { color: var(--ac-muted); font-weight: 400; }
.ac-kv dd { margin: 0; overflow-wrap: anywhere; }

/* table */
.ac-table { width: 100%; border-collapse: collapse; font-size: .93rem; }
.ac-table th { color: var(--ac-muted); font-weight: 500; font-size: .82rem; text-align: left; padding: 0 12px 10px; white-space: nowrap; }
.ac-table td { padding: 14px 12px; border-top: 1px solid var(--ac-line); vertical-align: middle; }
.ac-table th:first-child, .ac-table td:first-child { padding-left: 0; }
.ac-table th:last-child, .ac-table td:last-child { padding-right: 0; }
.ac-num { text-align: right !important; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ac-plus { color: #1c7a3d; }

/* empty and notes */
.ac-empty { text-align: center; padding: 40px 16px; color: var(--ac-muted); }
.ac-empty i { font-size: 2rem; color: #c8c8c8; margin-bottom: 12px; display: block; }
.ac-empty strong { display: block; color: var(--ac-ink); font-size: 1.05rem; margin-bottom: 6px; }
.ac-note { background: var(--ac-soft); border-radius: 12px; padding: 12px 14px; font-size: .88rem; color: #4a4a4a; }
.ac-help summary { cursor: pointer; font-weight: 600; list-style: none; display: flex; align-items: center; gap: 8px; }
.ac-help summary::-webkit-details-marker { display: none; }
.ac-help summary::after { content: '\f107'; font-family: 'Font Awesome 6 Free'; font-weight: 900; margin-left: auto; color: var(--ac-muted); transition: transform .2s; }
.ac-help[open] summary::after { transform: rotate(180deg); }
.ac-help ol { margin: 12px 0 0; padding-left: 20px; color: #4a4a4a; font-size: .92rem; }
.ac-help li + li { margin-top: 4px; }
.ac-divider { height: 1px; background: var(--ac-line); margin: 18px 0; }

/* custom select (account.js) */
.ac-select { position: relative; }
.ac-select > select { position: absolute; inset: 0; opacity: 0; pointer-events: none; }
.ac-select-button { width: 100%; min-height: 42px; display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: #fff; border: 1px solid #dcdcdc; border-radius: 10px; text-align: left; color: var(--ac-ink); font: inherit; cursor: pointer; }
.ac-select--sm .ac-select-button { min-height: 34px; padding: 5px 10px; font-size: .88rem; border-radius: 8px; }
.ac-select-button:hover { border-color: #bdbdbd; }
.ac-select-button:focus-visible, .ac-select.is-open .ac-select-button { outline: none; border-color: var(--ac-ink); box-shadow: 0 0 0 3px rgba(26, 26, 26, .08); }
.ac-select-value { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ac-select-button::after { content: '\f107'; font-family: 'Font Awesome 6 Free'; font-weight: 900; font-size: .8rem; color: var(--ac-muted); transition: transform .15s; }
.ac-select.is-open .ac-select-button::after { transform: rotate(180deg); }
.ac-select-menu { position: absolute; z-index: 1060; top: calc(100% + 6px); left: 0; min-width: 100%; width: max-content; max-width: min(360px, calc(100vw - 32px)); max-height: 320px; overflow-y: auto; background: #fff; border: 1px solid var(--ac-line); border-radius: 12px; box-shadow: 0 12px 32px rgba(0, 0, 0, .12); padding: 6px; display: none; }
.ac-select.is-open .ac-select-menu { display: block; }
.ac-select.is-up .ac-select-menu { top: auto; bottom: calc(100% + 6px); }
.ac-select.is-right .ac-select-menu { left: auto; right: 0; }
.ac-select-option { display: flex; gap: 10px; align-items: flex-start; padding: 9px 10px; border-radius: 8px; cursor: pointer; }
.ac-select-option:hover, .ac-select-option.is-focused { background: var(--ac-soft); }
.ac-select-option::before { content: '\f00c'; font-family: 'Font Awesome 6 Free'; font-weight: 900; font-size: .78rem; width: 14px; margin-top: 3px; color: transparent; }
.ac-select-option[aria-selected="true"]::before { color: var(--ac-ink); }
.ac-select-option-title { font-weight: 600; font-size: .92rem; }
.ac-select-option-hint { display: block; color: var(--ac-muted); font-size: .82rem; font-weight: 400; white-space: normal; }

/* file picker (account.js) */
.ac-file { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ac-file input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.ac-file-names { color: var(--ac-muted); font-size: .86rem; }

/* conversation */
.ac-letter { border: 1px solid var(--ac-line); border-radius: var(--ac-radius); padding: 18px 20px; background: #fff; }
.ac-letter + .ac-letter { margin-top: 12px; }
.ac-letter--out { background: #f7f7f7; border-color: #f0f0f0; margin-left: 48px; }
.ac-letter-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.ac-letter-body { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.55; }
.ac-letter-body .ac-quote { color: var(--ac-muted); }
.ac-attachments { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.ac-attachment { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border: 1px solid var(--ac-line); border-radius: 999px; font-size: .86rem; text-decoration: none !important; }
.ac-composer textarea { border: 0; padding: 0; min-height: 140px; resize: vertical; box-shadow: none !important; }
.ac-composer-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; border-top: 1px solid var(--ac-line); padding-top: 14px; margin-top: 10px; }

/* inbox rows */
.ac-mail { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-top: 1px solid var(--ac-line); }
.ac-mail:first-child { border-top: 0; }
.ac-mail:hover { background: #fafafa; }
.ac-mail .form-check-input { margin: 0; flex-shrink: 0; }
.ac-mail-link { display: flex; gap: 12px; align-items: center; flex: 1; min-width: 0; color: inherit !important; text-decoration: none !important; }
.ac-mail-from { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ac-mail-subject { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ac-mail-snippet { color: var(--ac-muted); }
.ac-mail.is-unread .ac-mail-from, .ac-mail.is-unread .ac-mail-subject { font-weight: 700; }
.ac-mail-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ac-red); flex-shrink: 0; }
.ac-mail-dot.is-read { background: transparent; }
.ac-mail-date { color: var(--ac-muted); font-size: .85rem; white-space: nowrap; }
.ac-bulk { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--ac-line); background: #fafafa; border-radius: var(--ac-radius) var(--ac-radius) 0 0; font-size: .9rem; }
.ac-search { position: relative; }
.ac-search i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--ac-muted); font-size: .85rem; }
.ac-search .form-control { padding-left: 34px; border-radius: 999px; }

@media (max-width: 991.98px) {
    .ac-layout { grid-template-columns: minmax(0, 1fr); }
    .ac-aside { position: static; }
}

@media (max-width: 767.98px) {
    .ac { padding: 20px 16px 40px; }
    .ac-head h1 { font-size: 1.5rem; }
    .ac-head-actions { width: 100%; }
    .ac-card { padding: 18px 16px; border-radius: 14px; }
    .ac-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 18px; }
    .ac-stat { padding: 12px; border-radius: 12px; }
    .ac-stat-label { font-size: .72rem; }
    .ac-stat-value { font-size: 1.1rem; }
    .ac-stat-foot { font-size: .74rem; padding-top: 4px; }
    .ac-tab { padding: 7px 12px; font-size: .86rem; }
    .ac-row { align-items: flex-start; }
    .ac-head-actions .btn { flex: 1; }
    .ac-choices--2, .ac-choices--3 { grid-template-columns: minmax(0, 1fr); }
    .ac-kv { grid-template-columns: minmax(0, 1fr); gap: 2px; }
    .ac-kv dd { margin-bottom: 10px; }
    .ac-letter--out { margin-left: 16px; }
    .ac-row { flex-wrap: wrap; }
    .ac-row-side { width: 100%; justify-content: flex-start; padding-left: 54px; }
    .ac-row--compact .ac-row-side { width: auto; padding-left: 0; }
    .ac-table--cards thead { display: none; }
    .ac-table--cards tr { display: block; padding: 12px 0; border-top: 1px solid var(--ac-line); }
    .ac-table--cards td { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; border: 0; text-align: right; }
    .ac-table--cards td::before { content: attr(data-label); color: var(--ac-muted); text-align: left; }
    .ac-table--cards td.ac-num { text-align: right !important; }
    .ac-mail-snippet { display: none; }
    .ac-step { gap: 10px; }
}
