:root {
    color-scheme: dark;
    --bg: #0b0b0c;
    --surface: #151516;
    --surface-strong: #202022;
    --surface-soft: #111112;
    --text: #f7f7f8;
    --muted: #a3a3a8;
    --line: rgba(200, 200, 205, 0.16);
    --accent: #d80000;
    --accent-strong: #ff2525;
    --accent-text: #ffffff;
    --positive: #42c98b;
    --warning: #f4ba54;
    --negative: #ff746c;
    --shadow: rgba(0, 5, 14, 0.34);
    --radius-card: 16px;
    --radius-control: 12px;
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --visible-viewport-height: 100dvh;
    --keyboard-offset: 0px;
    font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

:root[data-theme="light"] {
    color-scheme: light;
    --bg: #f2f5f8;
    --surface: #fbfcfe;
    --surface-strong: #e9eef4;
    --surface-soft: #f8fafc;
    --text: #111927;
    --muted: #5f6d80;
    --line: rgba(57, 72, 91, 0.17);
    --accent: #c60000;
    --accent-strong: #a80000;
    --accent-text: #ffffff;
    --positive: #13835b;
    --warning: #a96700;
    --negative: #c83e3e;
    --shadow: rgba(37, 50, 68, 0.12);
}

* {
    box-sizing: border-box;
}

html {
    background: var(--bg);
    color: var(--text);
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    min-width: 300px;
    min-height: 100dvh;
    background:
        radial-gradient(circle at 92% 0%, rgba(230, 0, 0, 0.08), transparent 28rem),
        var(--bg);
    color: var(--text);
}

button,
input {
    font: inherit;
}

button {
    color: inherit;
}

button:focus-visible,
input:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--accent) 62%, transparent);
    outline-offset: 2px;
}

button:active {
    transform: scale(0.98);
}

[hidden] {
    display: none !important;
}

.app-shell {
    width: min(100%, 760px);
    min-height: 100dvh;
    margin: 0 auto;
    padding: calc(var(--safe-top) + 12px) 16px calc(88px + var(--safe-bottom));
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 58px;
    margin: -12px -16px 8px;
    padding: calc(var(--safe-top) + 10px) 16px 10px;
    border-bottom: 1px solid var(--line);
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: blur(18px) saturate(130%);
    -webkit-backdrop-filter: blur(18px) saturate(130%);
}

.brand-logo {
    display: block;
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    border-radius: 50%;
    background: #fff;
    object-fit: contain;
}

.brand-lockup {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.brand-name-text {
    color: var(--text);
    font-size: 15px;
    font-weight: 850;
    letter-spacing: 0.01em;
}

.icon-button {
    display: inline-grid;
    min-width: 42px;
    height: 42px;
    place-items: center;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-control);
    background: var(--surface);
    font-size: 12px;
    font-weight: 750;
    cursor: pointer;
    transition: transform 180ms ease, background-color 180ms ease;
}

.icon-button.is-spinning span {
    display: inline-block;
    animation: spin 700ms linear infinite;
}

.main-content {
    padding-top: 14px;
}

.view {
    animation: view-in 260ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.welcome-block {
    padding: 8px 2px 24px;
}

.welcome-kicker,
.panel-label {
    margin: 0 0 8px;
    color: var(--accent-strong);
    font-size: 12px;
    font-weight: 750;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.welcome-block h1,
.view-heading h1,
.error-card h1 {
    margin: 0;
    font-size: clamp(29px, 7vw, 42px);
    line-height: 1.06;
    letter-spacing: -0.04em;
}

.welcome-block p:last-child,
.view-heading p,
.section-heading p,
.error-card p,
.security-note {
    margin: 10px 0 0;
    color: var(--muted);
    font-size: 15px;
    line-height: 1.5;
}

.balance-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 20px;
    align-items: end;
    min-height: 152px;
    padding: 22px;
    overflow: hidden;
    border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--line));
    border-radius: var(--radius-card);
    background:
        radial-gradient(circle at 95% 10%, rgba(216, 0, 0, 0.12), transparent 48%),
        linear-gradient(145deg, var(--surface-strong), var(--surface));
    box-shadow: 0 18px 46px var(--shadow);
}

.balance-value {
    margin: 0;
    font-size: clamp(35px, 10vw, 52px);
    font-weight: 800;
    letter-spacing: -0.05em;
    line-height: 1;
}

.balance-meta {
    display: grid;
    gap: 6px;
    min-width: 104px;
    padding-left: 18px;
    border-left: 1px solid var(--line);
}

.balance-meta span {
    color: var(--muted);
    font-size: 12px;
}

.balance-meta strong {
    font-size: 15px;
}

.quick-actions {
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    gap: 10px;
    margin-top: 12px;
}

.primary-action,
.secondary-action,
.account-actions button {
    min-height: 50px;
    padding: 12px 16px;
    border-radius: var(--radius-control);
    font-weight: 750;
    cursor: pointer;
    transition: transform 180ms ease, background-color 180ms ease, border-color 180ms ease;
}

.primary-action {
    border: 1px solid var(--accent);
    background: var(--accent);
    color: var(--accent-text);
}

.secondary-action,
.account-actions button {
    border: 1px solid var(--line);
    background: var(--surface);
}

.section-block {
    margin-top: 34px;
}

.section-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 14px;
}

.section-heading h2,
.detail-sheet h2 {
    margin: 0;
    font-size: 21px;
    letter-spacing: -0.025em;
}

.section-heading p {
    font-size: 13px;
}

.text-button {
    flex: 0 0 auto;
    padding: 8px 0;
    border: 0;
    background: transparent;
    color: var(--accent-strong);
    font-weight: 750;
    cursor: pointer;
}

.view-heading {
    padding: 8px 2px 22px;
}

.service-type-section {
    margin-bottom: 18px;
}

.service-type-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 10px;
}

.service-type-heading h2,
.service-type-heading p {
    margin: 0;
}

.service-type-heading h2 {
    font-size: 15px;
    letter-spacing: -0.01em;
}

.service-type-heading p {
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.4;
}

.service-type-all {
    flex: 0 0 auto;
    font-size: 12px;
}

.service-type-all.is-active {
    color: var(--muted);
}

.service-type-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
}

.service-type-grid.is-single {
    grid-template-columns: 1fr;
}

.service-type-card {
    display: grid;
    grid-template-areas:
        "code count"
        "copy count";
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 10px;
    align-items: start;
    min-width: 0;
    min-height: 108px;
    padding: 13px;
    border: 1px solid var(--line);
    border-radius: var(--radius-control);
    background: var(--surface);
    color: var(--text);
    text-align: left;
    cursor: pointer;
    transition: transform 180ms ease, border-color 180ms ease, background-color 180ms ease;
}

.service-type-card:hover,
.service-type-card.is-active {
    border-color: color-mix(in srgb, var(--accent) 62%, var(--line));
    background: color-mix(in srgb, var(--accent) 9%, var(--surface));
}

.service-type-card.is-active {
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 24%, transparent);
}

.service-type-code {
    grid-area: code;
    width: fit-content;
    padding: 4px 6px;
    border-radius: 7px;
    background: var(--surface-strong);
    color: var(--accent-strong);
    font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.06em;
}

.service-type-copy {
    display: grid;
    grid-area: copy;
    gap: 4px;
    min-width: 0;
}

.service-type-copy strong {
    font-size: 13px;
    line-height: 1.25;
}

.service-type-copy > span {
    display: -webkit-box;
    overflow: hidden;
    color: var(--muted);
    font-size: 10px;
    line-height: 1.35;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.service-type-count {
    display: grid;
    grid-area: count;
    min-width: 28px;
    min-height: 28px;
    padding: 4px 6px;
    place-items: center;
    border-radius: 8px;
    background: var(--surface-strong);
    color: var(--text);
    font-size: 11px;
    font-weight: 800;
}

.search-field {
    display: grid;
    gap: 8px;
    margin-bottom: 14px;
}

.search-field span {
    font-size: 13px;
    font-weight: 700;
}

.search-field input {
    width: 100%;
    min-height: 50px;
    padding: 0 15px;
    border: 1px solid var(--line);
    border-radius: var(--radius-control);
    background: var(--surface);
    color: var(--text);
}

.search-field input::placeholder {
    color: color-mix(in srgb, var(--muted) 80%, transparent);
}

.category-controls {
    display: grid;
    gap: 9px;
}

.category-picker {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    width: 100%;
    min-height: 64px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-control);
    background: var(--surface);
    color: var(--text);
    text-align: left;
    cursor: pointer;
    transition: border-color 180ms ease, background-color 180ms ease;
}

.category-picker:hover,
.category-picker.is-active {
    border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
    background: color-mix(in srgb, var(--accent) 8%, var(--surface));
}

.category-picker > span:first-child {
    display: grid;
    min-width: 0;
    gap: 3px;
}

.category-picker small {
    color: var(--muted);
    font-size: 11px;
    font-weight: 650;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.category-picker strong {
    overflow: hidden;
    font-size: 14px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.category-picker-count {
    flex: 0 0 auto;
    min-width: 34px;
    padding: 6px 9px;
    border-radius: 8px;
    background: var(--surface-strong);
    color: var(--accent-strong);
    font-size: 12px;
    font-weight: 800;
    text-align: center;
}

.quick-filter-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.quick-filter {
    min-height: 40px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius-control);
    background: var(--surface);
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.quick-filter.is-active {
    border-color: var(--accent);
    background: color-mix(in srgb, var(--accent) 14%, var(--surface));
    color: var(--text);
}

.category-sheet-search {
    margin: 18px 0 12px;
}

.category-sheet-list {
    display: grid;
    gap: 8px;
    max-height: min(52vh, 480px);
    padding-right: 2px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.category-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: stretch;
}

.category-select,
.favorite-toggle {
    min-height: 54px;
    border: 1px solid var(--line);
    border-radius: var(--radius-control);
    background: var(--surface-soft);
    cursor: pointer;
}

.category-select {
    display: grid;
    gap: 4px;
    padding: 10px 12px;
    text-align: left;
}

.category-select strong {
    font-size: 13px;
    line-height: 1.3;
}

.category-select span {
    color: var(--muted);
    font-size: 11px;
}

.category-select.is-active {
    border-color: var(--accent);
    background: color-mix(in srgb, var(--accent) 10%, var(--surface));
}

.favorite-toggle {
    width: 82px;
    padding: 8px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 750;
}

.favorite-toggle.is-favorite {
    border-color: color-mix(in srgb, var(--accent) 50%, var(--line));
    color: var(--accent-strong);
}

.result-summary {
    min-height: 24px;
    margin: 10px 2px;
    color: var(--muted);
    font-size: 13px;
}

.service-list,
.order-list {
    display: grid;
    gap: 10px;
}

.load-more-services {
    min-height: 46px;
    padding: 10px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-control);
    background: var(--surface);
    color: var(--accent-strong);
    font-size: 13px;
    font-weight: 800;
}

.service-card-shell {
    position: relative;
    min-width: 0;
}

.service-card,
.order-card {
    width: 100%;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius-card);
    background: var(--surface);
    color: var(--text);
    text-align: left;
    box-shadow: 0 8px 24px color-mix(in srgb, var(--shadow) 56%, transparent);
    cursor: pointer;
    transition: transform 180ms ease, border-color 180ms ease, background-color 180ms ease;
}

.service-card-shell .service-card {
    height: 100%;
    padding-right: 16px;
}

.service-favorite,
.detail-favorite {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 38px;
    border: 1px solid var(--line);
    border-radius: var(--radius-control);
    background: var(--surface-soft);
    color: var(--muted);
    font-size: 11px;
    font-weight: 750;
    cursor: pointer;
    transition: transform 180ms ease, border-color 180ms ease, background-color 180ms ease, color 180ms ease;
}

.service-favorite {
    position: absolute;
    top: 12px;
    right: 12px;
    min-width: 82px;
    padding: 7px 9px;
}

.detail-favorite {
    width: 100%;
    margin: 2px 0 14px;
    padding: 10px 12px;
}

.service-favorite > span:first-child,
.detail-favorite > span:first-child {
    color: var(--accent-strong);
    font-size: 15px;
    line-height: 1;
}

.service-favorite.is-favorite,
.detail-favorite.is-favorite {
    border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
    background: color-mix(in srgb, var(--accent) 11%, var(--surface));
    color: var(--accent-strong);
}

.service-favorite.is-saving,
.detail-favorite.is-saving {
    opacity: 0.66;
}

.favorites-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px;
}

.favorites-count {
    display: grid;
    min-width: 42px;
    height: 42px;
    place-items: center;
    border: 1px solid color-mix(in srgb, var(--accent) 42%, var(--line));
    border-radius: var(--radius-control);
    background: color-mix(in srgb, var(--accent) 10%, var(--surface));
    color: var(--accent-strong);
    font-weight: 850;
}

.favorite-empty strong {
    display: block;
    color: var(--text);
    font-size: 15px;
}

.favorite-empty p {
    margin: 7px auto 14px;
    max-width: 34ch;
    line-height: 1.45;
}

.favorite-empty .secondary-action {
    min-height: 42px;
}

.compact-favorites .service-card-shell:nth-child(n + 3) {
    display: none;
}

.service-card:hover,
.order-card:hover {
    border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
    background: var(--surface-strong);
}

.service-card-top,
.order-card-top,
.detail-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
}

.service-card-top {
    justify-content: flex-start;
}

.service-card h3,
.order-card h3 {
    margin: 0;
    font-size: 15px;
    line-height: 1.35;
}

.service-card-title {
    display: grid;
    min-width: 0;
}

.service-card-name {
    display: -webkit-box;
    margin-top: 24px !important;
    overflow: hidden;
    overflow-wrap: anywhere;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
}

.service-kind {
    width: fit-content;
    color: var(--accent-strong);
    font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.07em;
}

.service-price {
    display: block;
    width: fit-content;
    margin-top: 10px;
    white-space: normal;
    color: var(--accent-strong);
    font-size: 15px;
    font-weight: 800;
}

.service-price small {
    color: var(--muted);
    font-size: 10px;
    font-weight: 650;
}

.service-meta,
.order-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 7px 12px;
    margin-top: 12px;
    color: var(--muted);
    font-size: 12px;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 4px 9px;
    border-radius: 8px;
    background: var(--surface-strong);
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
}

.status-badge[data-status="completed"] {
    background: color-mix(in srgb, var(--positive) 16%, var(--surface));
    color: var(--positive);
}

.status-badge[data-status="processing"],
.status-badge[data-status="new"],
.status-badge[data-status="submitted"] {
    background: color-mix(in srgb, var(--warning) 15%, var(--surface));
    color: var(--warning);
}

.status-badge[data-status="rejected"] {
    background: color-mix(in srgb, var(--negative) 14%, var(--surface));
    color: var(--negative);
}

.order-reference {
    color: var(--accent-strong);
    font-size: 12px;
    font-weight: 800;
}

.order-input {
    display: block;
    margin-top: 11px;
    color: var(--text);
    font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
    font-size: 13px;
}

.order-list.compact .order-card:nth-child(n + 4) {
    display: none;
}

.empty-state {
    padding: 28px 20px;
    border: 1px dashed var(--line);
    border-radius: var(--radius-card);
    color: var(--muted);
    text-align: center;
}

.account-panel {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius-card);
    background: var(--surface);
}

.account-avatar {
    display: grid;
    width: 52px;
    height: 52px;
    place-items: center;
    border-radius: var(--radius-control);
    background: var(--accent);
    color: var(--accent-text);
    font-size: 22px;
    font-weight: 850;
}

.account-panel strong,
.account-panel span {
    display: block;
}

.account-panel span {
    margin-top: 5px;
    color: var(--muted);
    font-size: 13px;
}

.account-actions {
    display: grid;
    gap: 10px;
    margin-top: 12px;
}

.security-note {
    padding: 16px 4px;
    font-size: 13px;
}

.bottom-nav {
    position: fixed;
    z-index: 20;
    right: max(12px, calc((100vw - 760px) / 2 + 12px));
    bottom: calc(10px + var(--safe-bottom));
    left: max(12px, calc((100vw - 760px) / 2 + 12px));
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: var(--radius-card);
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    box-shadow: 0 18px 52px var(--shadow);
    backdrop-filter: blur(20px) saturate(135%);
    -webkit-backdrop-filter: blur(20px) saturate(135%);
}

.bottom-nav button {
    min-height: 47px;
    padding: 8px 5px;
    border: 0;
    border-radius: 11px;
    background: transparent;
    color: var(--muted);
    font-size: 11px;
    font-weight: 750;
    cursor: pointer;
}

.bottom-nav button.is-active {
    background: color-mix(in srgb, var(--accent) 15%, var(--surface));
    color: var(--accent-strong);
}

.loading-layer,
.error-layer {
    position: fixed;
    z-index: 50;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 24px;
    background: var(--bg);
}

.error-layer {
    align-items: start;
    overflow-y: auto;
}

.loading-brand {
    display: grid;
    width: min(100%, 320px);
    gap: 14px;
}

.loading-brand img {
    display: block;
    width: auto;
    max-width: min(230px, 76vw);
    max-height: 72px;
    object-fit: contain;
    margin: 0 auto 14px;
    animation: brand-pulse 1.8s ease-in-out infinite;
}

@keyframes brand-pulse {
    0%, 100% { opacity: 0.78; transform: scale(0.985); }
    50% { opacity: 1; transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
    .loading-brand img,
    .skeleton-line {
        animation: none;
    }
}

.skeleton-line {
    width: 62%;
    height: 14px;
    border-radius: 7px;
    background: linear-gradient(90deg, var(--surface), var(--surface-strong), var(--surface));
    background-size: 220% 100%;
    animation: shimmer 1.2s ease infinite;
}

.skeleton-line.wide {
    width: 100%;
    height: 26px;
}

.error-card {
    width: min(100%, 440px);
    margin: auto 0;
    padding: 24px;
    border: 1px solid var(--line);
    border-radius: var(--radius-card);
    background: var(--surface);
}

.error-label {
    color: var(--negative) !important;
    font-size: 13px !important;
    font-weight: 800;
}

.error-card .primary-action {
    width: 100%;
    margin-top: 18px;
}

.linking-help ol {
    display: grid;
    gap: 10px;
    margin: 18px 0 0;
    padding-left: 22px;
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
}

.error-card .linking-help p {
    font-size: 13px;
}

.error-card .linking-action {
    width: 100%;
    margin-top: 10px;
}

.sheet-backdrop {
    position: fixed;
    z-index: 30;
    inset: 0;
    background: rgba(3, 7, 13, 0.62);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.detail-sheet {
    position: fixed;
    z-index: 40;
    right: 0;
    bottom: var(--keyboard-offset);
    left: 0;
    max-height: min(calc(var(--visible-viewport-height) - 12px), 720px);
    padding: 12px 18px calc(22px + var(--safe-bottom));
    overflow-y: auto;
    overscroll-behavior: contain;
    scroll-padding: 18px 0 28px;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--line);
    border-bottom: 0;
    border-radius: 22px 22px 0 0;
    background: var(--surface);
    box-shadow: 0 -20px 70px var(--shadow);
    animation: sheet-in 280ms cubic-bezier(0.16, 1, 0.3, 1) both;
    transition: transform 520ms cubic-bezier(0.22, 0.61, 0.36, 1);
    will-change: transform;
}

.detail-sheet.is-keyboard-active {
    scroll-behavior: smooth;
}

.sheet-handle {
    width: 42px;
    height: 4px;
    margin: 0 auto 14px;
    border-radius: 2px;
    background: var(--line);
}

.sheet-close {
    float: right;
    padding: 7px 0 7px 12px;
    border: 0;
    background: transparent;
    color: var(--accent-strong);
    font-weight: 750;
    cursor: pointer;
}

.sheet-copy {
    clear: both;
    padding-top: 4px;
}

.sheet-copy > p {
    color: var(--muted);
    line-height: 1.5;
}

.detail-grid {
    display: grid;
    gap: 0;
    margin: 20px 0;
    border-top: 1px solid var(--line);
}

.detail-row {
    padding: 13px 0;
    border-bottom: 1px solid var(--line);
}

.detail-row span {
    color: var(--muted);
    font-size: 13px;
}

.detail-row.credit-line-message {
    justify-content: flex-start;
}

.detail-row.credit-line-message span {
    color: var(--text);
    line-height: 1.45;
}

.detail-row strong,
.detail-row code {
    max-width: 66%;
    color: var(--text);
    font-size: 13px;
    text-align: right;
    overflow-wrap: anywhere;
}

.result-block {
    padding: 15px;
    border-radius: var(--radius-control);
    background: var(--surface-soft);
    color: var(--text);
    font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
    font-size: 12px;
    line-height: 1.55;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.sheet-actions {
    display: grid;
    gap: 9px;
}

.sheet-actions button {
    width: 100%;
}

.order-form {
    display: grid;
    gap: 10px;
}

.order-field {
    display: grid;
    gap: 7px;
}

.order-field span {
    color: var(--text);
    font-size: 13px;
    font-weight: 750;
}

.order-field input,
.order-field select,
.order-field textarea {
    width: 100%;
    min-height: 52px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-control);
    background: var(--surface-soft);
    color: var(--text);
    font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
    font-size: 16px;
    letter-spacing: 0.02em;
}

.order-field select {
    font-family: inherit;
    letter-spacing: 0;
}

.order-field textarea {
    min-height: 100px;
    padding: 12px 14px;
    resize: vertical;
    font-family: inherit;
    letter-spacing: 0;
    line-height: 1.45;
}

.order-notice {
    margin-top: 16px;
    padding: 13px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-control);
    background: var(--surface-soft);
    color: var(--muted);
    font-size: 13px;
    line-height: 1.45;
}

.order-notice p {
    margin: 0;
}

.field-help,
.form-error,
.irreversible-note {
    margin: 0;
    font-size: 12px;
    line-height: 1.45;
}

.field-help {
    color: var(--muted);
}

.form-error {
    color: var(--negative);
    font-weight: 700;
}

.order-step {
    display: inline-flex;
    margin-bottom: 8px;
    color: var(--accent-strong);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.duplicate-warning {
    margin: 0 0 16px;
    padding: 14px;
    border: 1px solid color-mix(in srgb, var(--warning) 54%, var(--line));
    border-radius: var(--radius-control);
    background: color-mix(in srgb, var(--warning) 10%, var(--surface));
}

.duplicate-warning > strong {
    color: var(--warning);
}

.duplicate-warning > p {
    margin: 5px 0 12px;
    color: var(--muted);
    font-size: 12px;
}

.confirmation-check {
    display: grid;
    grid-template-columns: 20px minmax(0, 1fr);
    gap: 9px;
    align-items: start;
    color: var(--text);
    font-size: 12px;
    line-height: 1.4;
}

.confirmation-check input {
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--accent);
}

.irreversible-note {
    margin-bottom: 14px;
    color: var(--warning);
}

.danger-confirm {
    min-height: 50px;
    padding: 12px 16px;
    border: 1px solid color-mix(in srgb, var(--negative) 65%, var(--line));
    border-radius: var(--radius-control);
    background: var(--negative);
    color: #fffaf0;
    font-weight: 800;
    cursor: pointer;
}

.outcome-mark {
    display: grid;
    width: 48px;
    height: 48px;
    margin-bottom: 16px;
    border-radius: 50%;
    place-items: center;
    background: color-mix(in srgb, var(--warning) 15%, var(--surface));
    color: var(--warning);
    font-size: 28px;
    font-weight: 850;
}

.order-outcome[data-outcome="submitted"] .outcome-mark {
    background: color-mix(in srgb, var(--positive) 15%, var(--surface));
    color: var(--positive);
}

.order-outcome[data-outcome="rejected"] .outcome-mark {
    background: color-mix(in srgb, var(--negative) 14%, var(--surface));
    color: var(--negative);
}

.receipt-reference {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin: 18px 0;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-control);
    background: var(--surface-soft);
}

.receipt-reference span {
    color: var(--muted);
    font-size: 12px;
}

.receipt-reference strong {
    color: var(--accent-strong);
    font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.58;
    transform: none;
}

.toast {
    position: fixed;
    z-index: 70;
    right: 18px;
    bottom: calc(88px + var(--safe-bottom));
    left: 18px;
    max-width: 520px;
    margin: auto;
    padding: 13px 15px;
    border: 1px solid var(--line);
    border-radius: var(--radius-control);
    background: var(--surface-strong);
    box-shadow: 0 14px 44px var(--shadow);
    font-size: 13px;
    text-align: center;
    animation: toast-in 220ms ease both;
}

@keyframes view-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes sheet-in {
    from { opacity: 0; transform: translateY(28px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes toast-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes shimmer {
    to { background-position: -220% 0; }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@media (min-width: 700px) {
    .app-shell {
        padding-right: 24px;
        padding-left: 24px;
    }

    .topbar {
        margin-right: -24px;
        margin-left: -24px;
        padding-right: 24px;
        padding-left: 24px;
    }

    .service-list,
    .order-list:not(.compact) {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .detail-sheet {
        right: max(12px, calc((100vw - 760px) / 2 + 12px));
        bottom: max(12px, var(--keyboard-offset));
        left: max(12px, calc((100vw - 760px) / 2 + 12px));
        border-bottom: 1px solid var(--line);
        border-radius: 22px;
    }
}

@media (max-width: 430px) {
    .balance-panel {
        grid-template-columns: 1fr;
        min-height: 174px;
    }

    .balance-meta {
        grid-template-columns: 1fr auto;
        padding: 14px 0 0;
        border-top: 1px solid var(--line);
        border-left: 0;
    }

    .quick-actions {
        grid-template-columns: 1fr;
    }

    .service-card-shell .service-card {
        padding-right: 16px;
    }

    .service-favorite {
        min-width: 62px;
    }

    .service-favorite span:last-child {
        display: none;
    }
}

@media (max-width: 360px) {
    .service-type-grid {
        grid-template-columns: 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

@media (prefers-reduced-transparency: reduce) {
    .topbar,
    .bottom-nav,
    .sheet-backdrop {
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }
}
