* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    background:
        radial-gradient(circle at top, color-mix(in srgb, var(--primary) 16%, transparent) 0%, transparent 46%),
        linear-gradient(180deg, var(--bg), var(--bg2));
    color: var(--text);
    font-family: Bahnschrift, "Trebuchet MS", sans-serif;
}

a {
    color: inherit;
}

.app {
    max-width: 1440px;
    margin: 0 auto;
    padding: 16px;
}

.top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    background: var(--primary);
    border: 1px solid var(--primary);
    border-radius: 18px;
    padding: 14px 16px;
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.28);
    color: var(--text-light);
}

.ttl {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-light);
}

.meta {
    font-size: 13px;
    color: color-mix(in srgb, var(--text-light) 76%, var(--primary));
}

.acts {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn,
button,
.menu {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    border: 1px solid var(--line);
    background: color-mix(in srgb, var(--bgalt) 90%, #000000);
    color: var(--text);
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 14px;
    cursor: pointer;
    transition: 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.btn:hover,
button:hover,
.menu:hover {
    border-color: var(--primary2);
    transform: translateY(-1px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.22);
}

.btnp,
button.btnp {
    background: var(--primary);
    color: var(--text-light);
    border-color: var(--primary);
}

.btnp:hover,
button.btnp:hover {
    background: var(--primary2);
    border-color: var(--primary2);
}

.btnd,
button.btnd {
    color: var(--danger);
    border-color: color-mix(in srgb, var(--danger) 35%, var(--bgalt));
    background: color-mix(in srgb, var(--bgalt) 92%, #000000);
}

.flash {
    margin-top: 12px;
    border-radius: 10px;
    padding: 10px 12px;
    border: 1px solid;
    font-size: 14px;
}

.flash.ok {
    background: var(--okbg);
    color: var(--ok);
    border-color: color-mix(in srgb, var(--ok) 35%, #ffffff);
}

.flash.err {
    background: var(--errbg);
    color: var(--err);
    border-color: color-mix(in srgb, var(--err) 35%, #ffffff);
}

.panel {
    margin-top: 14px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 16px;
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.26);
}

dialog {
    border: 1px solid var(--line);
    border-radius: 22px;
    background: var(--card);
    color: var(--text);
    box-shadow: 0 28px 60px rgba(0, 0, 0, 0.45);
    padding: 22px;
    max-width: min(100vw - 24px, 560px);
}

dialog::backdrop {
    background: rgba(0, 0, 0, 0.68);
}

.panel h2,
.panel h3,
.panel h4 {
    margin: 0 0 10px;
}

.panel h2 {
    font-size: 18px;
}

.panel h3 {
    font-size: 16px;
}

.panel h4 {
    font-size: 14px;
}

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

.g3 {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

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

.fg,
.compact-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.span-2 {
    grid-column: span 2;
}

.span-4 {
    grid-column: span 4;
}

.f {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.f label {
    font-size: 13px;
    color: var(--muted);
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px 11px;
    font-size: 14px;
    background: color-mix(in srgb, var(--bgalt) 94%, #000000);
    color: var(--text);
}

input:focus,
select:focus,
textarea:focus {
    outline: 2px solid color-mix(in srgb, var(--primary2) 40%, transparent);
    border-color: var(--primary2);
}

textarea {
    min-height: 72px;
    resize: vertical;
}

.row {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.tbl {
    overflow: hidden;
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: color-mix(in srgb, var(--bgalt) 94%, #000000);
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    table-layout: auto;
    min-width: 400px;
}

th,
td {
    border-bottom: 1px solid var(--line);
    padding: 8px 9px;
    text-align: left;
    font-size: 13px;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
    vertical-align: top;
}

th {
    background: color-mix(in srgb, var(--bgalt) 78%, #000000);
}

.tag,
.dash-pill {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 999px;
    border: 1px solid var(--line);
    font-size: 11px;
}

.menu {
    min-height: 92px;
    text-align: center;
    font-weight: 600;
    background: var(--primary);
    border-color: var(--primary);
    color: var(--text-light);
}

.tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin: 8px 0 12px;
}

.tabs a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    border: 1px solid var(--primary);
    border-radius: 999px;
    text-decoration: none;
    color: var(--text-light);
    background: var(--primary);
}

.tabs a:hover,
.tabs a.active {
    background: var(--primary2);
    border-color: var(--primary2);
    color: var(--text-light);
}

.op-tabs a {
    font-weight: 600;
}

.seg-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.seg-tabs button {
    border-radius: 999px;
    border: 1px solid var(--line);
    background: color-mix(in srgb, var(--bgalt) 92%, #000000);
    color: var(--text);
    font-weight: 600;
    padding: 8px 14px;
}

.seg-tabs button.active {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--text-light);
}

.help {
    font-size: 12px;
    color: var(--muted);
}

.inline {
    display: inline;
    margin: 0;
}

.hidden {
    display: none;
}

.sep {
    height: 1px;
    background: var(--line);
    margin: 10px 0;
}

.autocomplete {
    position: relative;
    min-width: 280px;
    flex: 1;
}

.autocomplete-list {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: color-mix(in srgb, var(--bgalt) 96%, #000000);
    border: 1px solid var(--line);
    border-radius: 10px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.09);
    z-index: 20;
    max-height: 220px;
    overflow: auto;
    display: none;
}

.autocomplete-list.open {
    display: block;
}

.autocomplete-item {
    width: 100%;
    border: 0;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    background: color-mix(in srgb, var(--bgalt) 96%, #000000);
    color: var(--text);
    text-align: left;
    padding: 10px;
}

.autocomplete-item:last-child {
    border-bottom: 0;
}

.autocomplete-item:hover {
    background: color-mix(in srgb, var(--bgalt) 80%, var(--primary));
}

.customer-picker-form .btn {
    min-width: 92px;
}

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

.balance-box {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 10px;
    background: color-mix(in srgb, var(--bgalt) 94%, #000000);
    min-height: 76px;
}

.debt-box {
    border-color: color-mix(in srgb, #d32f2f 35%, #ffffff);
}

.credit-box {
    border-color: color-mix(in srgb, #1b8f3f 35%, #ffffff);
}

.balance-chip {
    display: inline-flex;
    margin: 4px 6px 0 0;
    border-radius: 999px;
    padding: 3px 9px;
    border: 1px solid transparent;
    font-size: 12px;
    font-weight: 600;
}

.balance-chip.pos,
.txt-pos {
    color: #1b8f3f;
}

.balance-chip.neg,
.txt-neg {
    color: #d32f2f;
}

.balance-chip.pos {
    background: color-mix(in srgb, #1b8f3f 10%, #ffffff);
    border-color: color-mix(in srgb, #1b8f3f 35%, #ffffff);
}

.balance-chip.neg {
    background: color-mix(in srgb, #d32f2f 10%, #ffffff);
    border-color: color-mix(in srgb, #d32f2f 35%, #ffffff);
}

.stock-box {
    grid-column: span 4;
    border: 1px dashed var(--line);
    border-radius: 10px;
    padding: 10px;
    background: color-mix(in srgb, var(--bgalt) 78%, var(--bg));
}

.payment-row {
    margin: 6px 0;
    align-items: flex-end;
}

.exchange-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 10px;
}

.exchange-side {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 10px;
    background: color-mix(in srgb, var(--bgalt) 94%, #000000);
}

.exchange-out {
    border-color: color-mix(in srgb, #d32f2f 35%, #ffffff);
}

.exchange-in {
    border-color: color-mix(in srgb, #1b8f3f 35%, #ffffff);
}

.dashboard-home {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.dashboard-hero {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 0 2px;
}

.dashboard-hero-no-logo {
    justify-content: flex-start;
}

.dashboard-hero-copy {
    display: grid;
    gap: 8px;
    min-width: 0;
}

.dashboard-hero-title {
    margin: 0;
    font-size: clamp(30px, 4vw, 42px);
    line-height: 1.08;
    font-weight: 800;
    color: color-mix(in srgb, var(--primary) 86%, #1e2d13);
}

.dashboard-hero-meta {
    font-size: 15px;
    color: var(--muted);
}

.dashboard-logo-wrap {
    min-width: 0;
    text-align: right;
}

.dashboard-logo-wrap-hero {
    flex: 0 0 clamp(220px, 25vw, 360px);
    align-self: flex-start;
}

.dashboard-logo {
    width: min(100%, 340px);
    height: auto;
    object-fit: contain;
}

.dashboard-top-row {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(220px, 360px);
    align-items: start;
    gap: 12px;
}

.dashboard-card-column {
    display: grid;
    gap: 6px;
    min-width: 0;
}

.dashboard-logo-col {
    display: flex;
    justify-content: flex-end;
    align-items: flex-start;
    min-width: 0;
}

.dashboard-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    max-height: 340px;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 2px 4px 4px 0;
    scrollbar-gutter: stable;
}

.dashboard-cards::-webkit-scrollbar {
    width: 6px;
    height: 8px;
}

.dashboard-cards::-webkit-scrollbar-track {
    background: color-mix(in srgb, var(--bgalt) 86%, #000000);
    border-radius: 999px;
}

.dashboard-cards::-webkit-scrollbar-thumb {
    background: color-mix(in srgb, var(--primary2) 86%, #000000);
    border-radius: 999px;
}

.dashboard-cards .dash-card {
    min-width: 0;
}

.dashboard-cards .empty-box {
    grid-column: 1 / -1;
}

.dash-card {
    background: linear-gradient(180deg, color-mix(in srgb, var(--primary) 92%, #000000), var(--primary));
    border: 1px solid var(--primary);
    border-radius: 16px;
    padding: 18px 18px 16px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.04);
    color: var(--text-light);
    min-height: 132px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.dash-card-head {
    display: flex;
    align-items: center;
    gap: 8px;
}

.dash-card-head-copy {
    display: grid;
    gap: 8px;
}

.dash-card-head h3 {
    margin: 0;
    font-size: 15px;
}

.dash-card-subtitle {
    font-size: 14px;
    color: color-mix(in srgb, var(--text-light) 78%, transparent);
}

.dash-balances {
    margin-top: 16px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 18px;
    align-items: start;
}

.dash-balance-line {
    display: flex;
    align-items: baseline;
    justify-content: flex-end;
    gap: 8px;
    font-weight: 700;
    color: var(--text-light);
    min-width: 0;
    width: 100%;
}

.dash-balance-line.neg {
    color: color-mix(in srgb, #ffd0d0 80%, var(--text-light));
}

.dash-balance-amount {
    font-size: clamp(20px, 2.2vw, 32px);
    line-height: 1;
    white-space: nowrap;
}

.dash-balance-currency {
    font-size: 15px;
    white-space: nowrap;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
    gap: 14px;
}

.dashboard-block {
    border: 1px solid color-mix(in srgb, var(--primary) 28%, var(--line));
    border-radius: 18px;
    padding: 16px 18px;
    background: linear-gradient(145deg, color-mix(in srgb, var(--bgalt) 96%, #000000), color-mix(in srgb, var(--card) 92%, var(--primary)));
    box-shadow: 0 4px 20px rgba(0,0,0,0.12), inset 0 1px 0 rgba(255,255,255,0.04);
    transition: box-shadow 0.22s ease, border-color 0.22s ease;
}

.dashboard-block:hover {
    box-shadow: 0 8px 32px rgba(0,0,0,0.18), inset 0 1px 0 rgba(255,255,255,0.06);
    border-color: color-mix(in srgb, var(--primary) 42%, var(--line));
}

.block-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
}

.block-head h3 {
    font-size: 15px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.block-head .muted {
    font-size: 11px;
}

.dashboard-block .tbl table tbody tr {
    transition: background 0.15s ease;
}

.dashboard-block .tbl table tbody tr:hover {
    background: color-mix(in srgb, var(--primary) 8%, transparent);
}

.dashboard-block .tbl table tbody tr:nth-child(even) {
    background: color-mix(in srgb, var(--bgalt) 50%, transparent);
}

.dashboard-block .tbl table tbody tr:nth-child(even):hover {
    background: color-mix(in srgb, var(--primary) 10%, color-mix(in srgb, var(--bgalt) 50%, transparent));
}

.dashboard-block .tbl th {
    background: linear-gradient(180deg, color-mix(in srgb, var(--primary) 92%, #000000), var(--primary));
    color: var(--text-light);
    border-bottom-color: color-mix(in srgb, var(--primary) 70%, var(--line));
}

.dashboard-modules-title {
    margin: 4px 0;
}

.empty-box {
    border: 1px dashed var(--line);
    border-radius: 12px;
    padding: 14px;
}

.pairing-panel {
    max-width: min(680px, calc(100% - 16px));
    margin: 40px auto;
    text-align: center;
}

.pairing-logo-wrap {
    margin-bottom: 20px;
}

.pairing-logo {
    width: min(240px, 72%);
    height: auto;
}

.pairing-help {
    max-width: 560px;
    margin: 0 auto 20px;
    line-height: 1.6;
    text-wrap: balance;
}

.pairing-reader {
    width: 100%;
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 20px;
    display: none;
    border: 2px dashed var(--primary2);
    background: color-mix(in srgb, var(--bgalt) 94%, #000000);
}

.pairing-btn,
.pairing-submit {
    width: 100%;
    min-height: 54px;
    font-size: 16px;
}

.pairing-form {
    margin-top: 20px;
    grid-template-columns: 1fr;
    max-width: 560px;
    margin-left: auto;
    margin-right: auto;
}

.pairing-code-input {
    min-width: 220px;
    min-height: 64px;
    font-size: clamp(24px, 4.2vw, 34px);
    text-align: center;
    letter-spacing: 0.4em;
}

.dashboard-profile-card {
    flex: 1;
    min-width: 280px;
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 18px;
    background: linear-gradient(135deg, color-mix(in srgb, var(--bgalt) 90%, #000000), color-mix(in srgb, var(--primary) 18%, var(--card)));
}

.dashboard-profile-card h2 {
    margin: 4px 0 8px;
    font-size: clamp(24px, 4vw, 34px);
}

.dashboard-eyebrow,
.dashboard-section-title {
    font-size: 12px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--muted);
}

.dashboard-section {
    display: grid;
    gap: 6px;
    margin-top: 0;
}

/* Navigation buttons */
.btn-nav {
    background: linear-gradient(135deg, var(--primary), var(--primary2));
    color: var(--text-light) !important;
    border-color: var(--primary);
    font-weight: 700;
    padding: 10px 20px;
    border-radius: 12px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.18);
    gap: 6px;
    font-size: 14px;
    letter-spacing: 0.02em;
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.btn-nav:hover {
    background: linear-gradient(135deg, var(--primary2), var(--primary));
    border-color: var(--primary2);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.26);
    color: var(--text-light) !important;
}

.dashboard-stack {
    display: grid;
    gap: 12px;
}

.dashboard-modules-grid .menu {
    min-height: 108px;
    background: linear-gradient(180deg, color-mix(in srgb, var(--primary) 92%, #000000), var(--primary));
    border-color: var(--primary);
    border-radius: 18px;
    font-size: 15px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.04);
    color: var(--text-light);
}

.dashboard-modules-grid .menu:hover,
.menu:hover {
    background: var(--primary2);
    border-color: var(--primary2);
    color: var(--text-light);
}

@media (max-width: 1440px) {
    .app {
        padding: 18px;
    }
}

@media (max-width: 1024px) {
    .g3 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .g2,
    .dashboard-grid,
    .exchange-grid,
    .balance-grid {
        grid-template-columns: 1fr;
    }

    .fg,
    .compact-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

}

@media (min-width: 1025px) {
    .dashboard-cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-template-rows: repeat(2, auto);
        grid-auto-flow: column;
        grid-auto-columns: minmax(240px, 1fr);
        max-height: 320px;
        overflow-x: auto;
        overflow-y: auto;
        align-items: start;
    }
}

@media (max-width: 768px) {
    .g3,
    .g2,
    .fg,
    .compact-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-top-row {
        grid-template-columns: 1fr;
    }

    .dashboard-logo-col {
        justify-content: flex-start;
    }

    .dashboard-cards {
        grid-template-columns: 1fr;
        max-height: 320px;
        overflow-y: auto;
    }

    .dashboard-cards .dash-card,
    .dashboard-cards .empty-box {
        min-width: 0;
        max-width: none;
        width: 100%;
    }

    .dash-balances {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .acts {
        width: 100%;
    }

    .acts form,
    .acts a,
    .btn,
    button {
        width: 100%;
    }

    .top {
        align-items: flex-start;
    }

    .dashboard-hero {
        flex-direction: column;
        align-items: flex-start;
    }

    .dashboard-logo-wrap {
        width: 100%;
        text-align: left;
    }

    .dashboard-logo-wrap-hero {
        flex-basis: auto;
    }

    .pairing-panel {
        margin-top: 20px;
    }

    .span-2,
    .span-4,
    .stock-box {
        grid-column: span 1;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-block {
        min-width: 0;
        overflow: hidden;
    }

    table {
        min-width: 320px;
    }

    .tbl {
        border-radius: 8px;
    }

}

.backup-quota-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin: 12px 0 20px;
}

.backup-quota-item {
    background: var(--bgalt, #f5f5f0);
    border-radius: 10px;
    padding: 12px 14px;
    border: 1px solid rgba(0, 0, 0, 0.07);
}

.backup-quota-label {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text, #222);
}

.backup-quota-nums {
    font-weight: 400;
    color: var(--muted, #666);
}

.backup-quota-bar {
    height: 8px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 999px;
    overflow: hidden;
}

.backup-quota-fill {
    height: 100%;
    border-radius: 999px;
    transition: width 0.4s ease;
}

.backup-quota-fill-backup {
    background: linear-gradient(90deg, #2d7a2d, #4caf50);
}

.backup-quota-fill-restore {
    background: linear-gradient(90deg, #1a6b9a, #2196f3);
}

.backup-quota-fill[style*="width: 100%"] {
    background: linear-gradient(90deg, #b42318, #e53935) !important;
}

@media (max-width: 600px) {
    .backup-quota-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    th,
    td {
        font-size: 12px;
        padding: 7px;
    }

    .pairing-code-input {
        letter-spacing: 0.22em;
        padding-inline: 10px;
    }

    .dashboard-profile-card {
        min-width: 0;
    }
}

@media (max-width: 320px) {
    .app {
        padding: 10px;
    }

    .top,
    .panel {
        padding: 12px;
    }

    .pairing-code-input {
        min-width: 0;
        font-size: 22px;
        letter-spacing: 0.14em;
    }
}

/* Barkod Okuyucu Modal */
#global-scanner-modal {
    padding: 15px;
    text-align: center;
    border-radius: 18px;
    width: 90vw;
    max-width: 400px;
}
#global-scanner-modal::backdrop {
    background: rgba(0, 0, 0, 0.8);
}
#global-reader {
    width: 100%;
    min-height: 250px;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 15px;
}
.scan-barcode-btn {
    background: var(--primary);
    color: white;
    font-size: 18px;
    border-radius: 8px;
    min-width: 45px;
}


