:root {
    --bg: #f8f9fb;
    --surface: #ffffff;
    --surface-soft: #f4f6fa;
    --sidebar: #ffffff;
    --text: #252f4a;
    --muted: #78829d;
    --line: #e4e6ef;
    --line-strong: #dbdfe9;
    --primary: #1b84ff;
    --primary-dark: #056ee9;
    --primary-soft: #eef6ff;
    --success: #17c653;
    --success-soft: #eafff1;
    --danger: #f8285a;
    --danger-soft: #fff0f4;
    --warning: #f6b100;
    --radius: 8px;
    --shadow: 0 10px 30px rgba(37, 47, 74, .06);
    --sidebar-width: 270px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 14px;
    letter-spacing: 0;
    overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
h1, h2, p { margin: 0; }
h1 { color: #071437; font-size: 28px; font-weight: 700; line-height: 1.25; }
h2 { color: #071437; font-size: 16px; font-weight: 700; line-height: 1.35; }
.muted, .page-head p, .panel-title p, .history-item span, .history-item small { color: var(--muted); }

button, .button {
    border: 1px solid transparent;
    border-radius: var(--radius);
    background: var(--primary);
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    padding: 0 14px;
    font: inherit;
    font-weight: 600;
    white-space: nowrap;
    transition: background .18s ease, border-color .18s ease, color .18s ease, box-shadow .18s ease, transform .18s ease;
}
button:hover, .button:hover { background: var(--primary-dark); box-shadow: 0 8px 18px rgba(27, 132, 255, .18); }
button:active, .button:active { transform: translateY(1px); }
button:disabled { cursor: wait; opacity: .65; }

input, select, textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    min-height: 40px;
    padding: 9px 12px;
    color: var(--text);
    font: inherit;
    outline: 0;
    transition: border-color .18s ease, box-shadow .18s ease;
}
input:focus, select:focus, textarea:focus {
    border-color: rgba(27, 132, 255, .65);
    box-shadow: 0 0 0 3px rgba(27, 132, 255, .12);
}
textarea { resize: vertical; line-height: 1.5; }
label { display: grid; gap: 7px; color: #4b5675; font-weight: 600; }

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
}
.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 10;
    width: var(--sidebar-width);
    background: var(--sidebar);
    border-right: 1px solid var(--line);
    color: var(--text);
    padding: 18px 14px;
    display: flex;
    flex-direction: column;
    gap: 22px;
}
.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 8px 14px;
    border-bottom: 1px solid var(--line);
}
.brand-mark {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: var(--primary);
    color: #fff;
    font-weight: 800;
    box-shadow: 0 8px 18px rgba(27, 132, 255, .22);
}
.brand-text {
    display: grid;
    gap: 2px;
    color: #071437;
    font-size: 15px;
    font-weight: 700;
}
.brand-text small {
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
}
.side-nav { display: grid; gap: 5px; }
.side-nav a {
    display: flex;
    align-items: center;
    gap: 11px;
    border-radius: var(--radius);
    color: #4b5675;
    min-height: 40px;
    padding: 9px 11px;
    font-weight: 600;
}
.side-nav i {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    color: #99a1b7;
    font-size: 18px;
}
.side-nav a.active, .side-nav a:hover {
    background: var(--primary-soft);
    color: var(--primary);
}
.side-nav a.active i, .side-nav a:hover i { color: var(--primary); }
.logout-form { margin-top: auto; }
.ghost {
    width: 100%;
    background: #fff;
    border-color: var(--line);
    color: #4b5675;
}
.ghost:hover {
    background: var(--surface-soft);
    border-color: var(--line-strong);
    color: #071437;
    box-shadow: none;
}
.content {
    grid-column: 2;
    min-width: 0;
    padding: 0;
}
.topbar {
    position: sticky;
    top: 0;
    z-index: 6;
    min-height: 64px;
    background: rgba(255, 255, 255, .88);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 0 28px;
}
.topbar strong { display: block; color: #071437; font-size: 15px; }
.topbar span { color: var(--muted); font-size: 12px; font-weight: 600; }
.topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}
.live-dot {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
    min-height: 34px;
    padding: 0 12px;
}
.live-dot i {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 0 4px rgba(23, 198, 83, .14);
}
.icon-button {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    color: #4b5675;
}
.icon-button:hover { color: var(--primary); border-color: rgba(27, 132, 255, .35); }
.content-inner {
    width: min(100%, 1440px);
    margin: 0 auto;
    padding: 28px;
}
.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 22px;
}
.app-head { margin-bottom: 14px; }
.page-head p { margin-top: 6px; font-weight: 500; }
.head-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.metrics, .ops-strip {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 18px;
}
.ops-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.metrics article, .ops-strip article, .panel, .login-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.metrics article, .ops-strip article {
    position: relative;
    overflow: hidden;
    padding: 18px;
    display: grid;
    gap: 8px;
}
.metrics article::before, .ops-strip article::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 3px;
    background: var(--primary);
}
.metrics span, .ops-strip span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}
.metrics strong {
    color: #071437;
    font-size: 25px;
    font-weight: 700;
}
.ops-strip strong {
    color: #071437;
    font-size: 17px;
    font-weight: 700;
}
.panel {
    padding: 20px;
    margin-bottom: 18px;
}
.app-panel { padding: 18px; }
.narrow { max-width: 920px; }
.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius);
}
table {
    border-collapse: collapse;
    width: 100%;
    min-width: 1040px;
    background: #fff;
}
th, td {
    border-bottom: 1px solid var(--line);
    padding: 12px 14px;
    text-align: left;
    vertical-align: middle;
}
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fcfcfd; }
th {
    color: var(--muted);
    background: #f9f9fb;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}
.status {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    background: var(--success-soft);
    color: #04a550;
    padding: 5px 9px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}
.product-description {
    min-width: 220px;
    max-width: 360px;
    color: #4b5675;
    font-size: 13px;
    line-height: 1.45;
}
.product-description:empty::before {
    content: "Belum ada deskripsi";
    color: var(--muted);
}
.empty {
    color: var(--muted);
    text-align: center;
    padding: 28px;
}
.alert, .inline-message {
    border: 1px solid rgba(23, 198, 83, .25);
    border-radius: var(--radius);
    margin-bottom: 18px;
    padding: 12px 14px;
    background: var(--success-soft);
    color: #04a550;
    font-weight: 700;
}
.inline-message:empty { display: none; }
.alert.danger, .inline-message.danger {
    border-color: rgba(248, 40, 90, .25);
    background: var(--danger-soft);
    color: var(--danger);
}
.inline-message.success { background: var(--success-soft); color: #04a550; }
.realtime-toast {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 20;
    display: grid;
    gap: 4px;
    max-width: 360px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    box-shadow: 0 18px 45px rgba(37, 47, 74, .16);
    padding: 14px 16px;
}
.realtime-toast strong { color: #071437; }
.realtime-toast span { color: var(--muted); }

.column-filters {
    display: grid;
    grid-template-columns: repeat(7, minmax(120px, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}
.catalog-hidden-filters { display: none; }
.catalog-active-filter {
    display: inline-flex;
    width: fit-content;
    align-items: center;
    border: 1px solid rgba(27, 132, 255, .25);
    border-radius: 999px;
    background: var(--primary-soft);
    color: var(--primary);
    padding: 7px 11px;
    margin-bottom: 12px;
    font-weight: 700;
    font-size: 12px;
}
.compact-button { width: auto; }
.row-edit-button {
    width: auto;
    min-height: 32px;
    padding: 0 10px;
}
.table-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 14px;
}
.table-toolbar input { max-width: 340px; }
.stack, .grid-form, .native-form { display: grid; gap: 14px; }
.grid-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-form .actions { grid-column: 1 / -1; }
.settings-checks {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    padding: 12px;
}
.wide-field {
    grid-column: 1 / -1;
}
.wide-field small {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.4;
}
.role-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}
.role-grid article {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    padding: 14px;
    display: grid;
    gap: 6px;
}
.role-grid span, .role-grid small { color: var(--muted); font-weight: 700; }
.role-grid strong { color: #071437; font-size: 26px; }
.user-create-form {
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius);
    background: #fcfcfd;
    padding: 14px;
    margin-bottom: 16px;
}
.user-card-list { display: grid; gap: 14px; }
.user-card {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    padding: 14px;
}
.user-card .grid-form {
    grid-template-columns: 54px repeat(3, minmax(0, 1fr));
    align-items: end;
}
.user-avatar {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: var(--radius);
    background: var(--primary);
    color: #fff;
    font-weight: 800;
}
.delete-user-form {
    display: flex;
    justify-content: flex-end;
    margin-top: 10px;
}
.delete-user-form .ghost {
    width: auto;
    color: var(--danger);
}
.inline-form {
    display: grid;
    grid-template-columns: repeat(4, minmax(160px, 1fr));
    gap: 12px;
    align-items: end;
}

.auth-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 20px;
    background:
        radial-gradient(circle at top left, rgba(27, 132, 255, .13), transparent 34%),
        linear-gradient(135deg, #f7f9fc 0%, #eef3fb 100%);
}
.login-card {
    width: min(430px, 100%);
    padding: 30px;
    display: grid;
    gap: 24px;
}
.eyebrow {
    color: var(--primary);
    font-weight: 700;
    margin-bottom: 8px;
}

.mobile-tabs {
    position: sticky;
    top: 64px;
    z-index: 4;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    background: rgba(248, 249, 251, .92);
    backdrop-filter: blur(12px);
    padding: 8px 0 14px;
    margin-bottom: 8px;
}
.mobile-tabs a, .mobile-tabs button {
    min-height: 38px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    color: #4b5675;
    font-weight: 700;
    box-shadow: none;
}
.mobile-tabs a:hover, .mobile-tabs button:hover {
    background: var(--primary-soft);
    color: var(--primary);
    box-shadow: none;
}
.mobile-tabs .active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}
.page-tabs {
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
}
.brand-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 8px;
    margin-bottom: 12px;
}
.catalog-group-label {
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0;
    margin: 2px 0 8px;
    text-transform: uppercase;
}
.brand-choice-grid[hidden], .catalog-group-label[hidden] {
    display: none;
}
.brand-card[hidden], .brand-choice-card[hidden] {
    display: none;
}
.brand-card {
    justify-content: flex-start;
    min-height: 58px;
    border-color: var(--line);
    background: #fff;
    color: var(--text);
    box-shadow: none;
    padding: 9px;
    text-align: left;
    white-space: normal;
    gap: 8px;
    min-width: 0;
}
.brand-card:hover, .brand-card.active {
    background: var(--primary-soft);
    color: var(--primary);
    border-color: rgba(27, 132, 255, .35);
    box-shadow: none;
}
.brand-card-icon {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: var(--primary);
    color: #fff;
    font-weight: 800;
    font-size: 12px;
    flex: 0 0 auto;
}
.brand-card span:last-child {
    display: grid;
    gap: 2px;
    min-width: 0;
}
.brand-card strong {
    overflow: hidden;
    font-size: 13px;
    text-overflow: ellipsis;
}
.brand-card small {
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
}
.transaction-shortcuts {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 12px;
}
.transaction-shortcuts button {
    justify-content: center;
    min-height: 64px;
    border-color: var(--line);
    background: #fff;
    color: var(--text);
    box-shadow: var(--shadow);
    padding: 10px;
    text-align: center;
    flex-direction: column;
    gap: 7px;
}
.transaction-shortcuts button:hover,
.transaction-shortcuts button.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}
.transaction-shortcuts i {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: var(--primary-soft);
    color: var(--primary);
    font-size: 16px;
    flex: 0 0 auto;
}
.transaction-shortcuts button.active i,
.transaction-shortcuts button:hover i {
    background: rgba(255,255,255,.18);
    color: #fff;
}
.transaction-shortcuts span {
    display: block;
    font-weight: 800;
    font-size: 13px;
}
.transaction-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
}
.tab-panel { display: none; }
.tab-panel.active { display: grid; }
.panel-title {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}
.panel-title > span {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: var(--radius);
    background: var(--primary-soft);
    color: var(--primary);
    font-weight: 800;
}
.panel-title p { margin-top: 4px; }
.transaction-card-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}
.transaction-card-head > span {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: var(--primary-soft);
    color: var(--primary);
    font-size: 18px;
}
.product-picker {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    min-width: 0;
}
.selected-product-description {
    display: grid;
    gap: 5px;
    border: 1px solid rgba(27, 132, 255, .18);
    border-radius: 14px;
    background: var(--primary-soft);
    color: #4b5675;
    padding: 12px;
    line-height: 1.45;
}
.selected-product-description[hidden] { display: none; }
.selected-product-description strong {
    color: #071437;
    font-size: 13px;
}
.selected-product-description span {
    overflow-wrap: anywhere;
}
.selected-product-description small {
    color: var(--primary);
    font-weight: 700;
}
.switch-row {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
}
.switch-row input { width: 18px; min-height: 18px; }
.sub-form {
    border-top: 1px dashed var(--line-strong);
    margin-top: 16px;
    padding-top: 16px;
}
.tool-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}
.compact-tools { grid-template-columns: 1fr; }
.history-table {
    display: grid;
    gap: 8px;
    min-width: 0;
}
.history-table-head,
.history-table-row {
    display: grid;
    grid-template-columns: minmax(120px, 1fr) minmax(82px, .75fr) minmax(82px, .75fr) minmax(170px, 1.45fr) minmax(78px, .7fr) minmax(76px, .65fr) minmax(46px, .45fr) minmax(48px, .45fr);
    gap: 8px;
    align-items: center;
}
.history-table-head {
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #f9f9fb;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    padding: 10px;
    text-transform: uppercase;
}
.history-table-row {
    border: 1px solid var(--line);
    border-radius: 12px;
    background: linear-gradient(180deg, #fff 0%, #fbfcfe 100%);
    color: #4b5675;
    font-size: 12px;
    padding: 10px;
}
.history-table-row > div {
    min-width: 0;
    overflow-wrap: anywhere;
}
.history-table-row strong {
    color: #071437;
    font-size: 12px;
}
.history-table-row small {
    display: block;
    color: var(--muted);
    font-size: 11px;
    margin-top: 2px;
}
.history-product-cell {
    display: grid;
    gap: 2px;
    font-weight: 700;
}
.row-form button {
    min-height: 32px;
    padding: 0 9px;
}
.failure-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    max-height: 420px;
    overflow: auto;
    padding-right: 4px;
}
.failure-reason {
    display: grid;
    gap: 6px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    padding: 12px;
}
.failure-reason strong {
    color: #071437;
    font-size: 13px;
}
.failure-reason span, .failure-hint {
    display: inline-flex;
    width: fit-content;
    border-radius: 999px;
    padding: 5px 8px;
    font-size: 12px;
    font-weight: 700;
}
.failure-reason .is-formed {
    background: #fff8dd;
    color: #dfa000;
}
.failure-reason .not-formed {
    background: var(--danger-soft);
    color: var(--danger);
}
.failure-hint {
    margin-top: 5px;
    background: #fff8dd;
    color: #946200;
    line-height: 1.45;
    border-radius: var(--radius);
}
.failure-source { margin-top: 12px; font-size: 12px; }
.check {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
}
.check input { width: auto; min-height: auto; }

@media (max-width: 1080px) {
    .metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .tool-grid { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
    .app-shell { display: block; }
    .sidebar {
        position: fixed;
        inset: auto 0 0 0;
        z-index: 8;
        width: auto;
        min-height: auto;
        padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
        border-top: 1px solid var(--line);
        border-right: 0;
        gap: 0;
        box-shadow: 0 -8px 22px rgba(37, 47, 74, .08);
    }
    .brand { display: none; }
    .side-nav {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 6px;
    }
    .side-nav a {
        display: grid;
        place-items: center;
        gap: 3px;
        min-height: 44px;
        padding: 6px;
        font-size: 11px;
    }
    .side-nav i { font-size: 18px; }
    .logout-form { display: none; }
    .content { margin-left: 0; }
    .topbar {
        min-height: 58px;
        padding: 0 14px;
    }
    .topbar-actions .live-dot { display: none; }
    .content-inner {
        padding: 18px 12px 92px;
    }
    .transaction-app-head {
        border-radius: 0 0 18px 18px;
        background: linear-gradient(135deg, #1b84ff 0%, #056ee9 100%);
        color: #fff;
        margin: -18px -12px 12px;
        padding: 16px 14px 18px;
    }
    .transaction-app-head h1,
    .transaction-app-head p { color: #fff; }
    .transaction-app-head p { opacity: .82; }
    .transaction-shortcuts {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        margin-top: -4px;
        gap: 8px;
    }
    .transaction-shortcuts button {
        min-height: 70px;
        border-radius: 16px;
        box-shadow: 0 10px 24px rgba(37, 47, 74, .08);
    }
    .transaction-card {
        border-radius: 18px;
        margin-bottom: 12px;
        box-shadow: 0 12px 28px rgba(37, 47, 74, .08);
        padding-top: 16px;
    }
    .transaction-card .panel-title > span,
    .transaction-card-head > span {
        width: 44px;
        height: 44px;
        border-radius: 14px;
    }
    .transaction-card-head {
        margin-bottom: 12px;
    }
    .transaction-card-head h2 {
        font-size: 17px;
    }
    .native-form {
        gap: 12px;
    }
    .transaction-card input,
    .transaction-card select,
    .transaction-card textarea {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        min-height: 46px;
        border-radius: 12px;
        font-size: 16px;
    }
    .product-picker {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    .transaction-card button[type="submit"] {
        min-height: 48px;
        border-radius: 14px;
        width: 100%;
        font-size: 15px;
    }
    .transaction-history-panel {
        border-radius: 18px;
        box-shadow: 0 12px 28px rgba(37, 47, 74, .08);
    }
    .transaction-history-panel .table-toolbar {
        margin-bottom: 10px;
    }
    .page-head { align-items: flex-start; flex-direction: column; }
    h1 { font-size: 24px; }
    .metrics, .ops-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-form, .inline-form { grid-template-columns: 1fr; }
    .settings-checks { grid-template-columns: 1fr; }
    .brand-card-grid, .role-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .product-table-wrap {
        overflow-x: visible;
    }
    .product-catalog-table {
        min-width: 0;
        table-layout: fixed;
    }
    .product-catalog-table th,
    .product-catalog-table td {
        padding: 8px 6px;
        font-size: 11px;
    }
    .product-catalog-table th:nth-child(1),
    .product-catalog-table td:nth-child(1),
    .product-catalog-table th:nth-child(3),
    .product-catalog-table td:nth-child(3),
    .product-catalog-table th:nth-child(4),
    .product-catalog-table td:nth-child(4),
    .product-catalog-table th:nth-child(6),
    .product-catalog-table td:nth-child(6),
    .product-catalog-table th:nth-child(7),
    .product-catalog-table td:nth-child(7),
    .product-catalog-table th:nth-child(9),
    .product-catalog-table td:nth-child(9) {
        display: none;
    }
    .product-catalog-table td strong {
        font-size: 12px;
        overflow-wrap: anywhere;
    }
    .user-card .grid-form { grid-template-columns: 1fr; }
    .head-actions { flex-wrap: wrap; width: 100%; }
    .table-toolbar { align-items: stretch; flex-direction: column; }
    .table-toolbar input { max-width: none; }
    .column-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .history-table-head { display: none; }
    .history-table-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        align-items: start;
    }
    .history-table-row > div::before {
        content: attr(data-label);
        display: block;
        color: var(--muted);
        font-size: 10px;
        font-weight: 800;
        margin-bottom: 3px;
        text-transform: uppercase;
    }
    .history-table-row > div:nth-child(4) {
        grid-column: 1 / -1;
    }
    .failure-grid { grid-template-columns: 1fr; }
    .mobile-tabs { top: 58px; }
}

@media (max-width: 560px) {
    .metrics, .ops-strip, .tool-grid { grid-template-columns: 1fr; }
    .brand-card-grid, .role-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .brand-card {
        min-height: 54px;
        padding: 8px;
    }
    .brand-card-icon {
        width: 30px;
        height: 30px;
    }
    .panel, .app-panel {
        border-left: 0;
        border-right: 0;
        border-radius: 0;
        margin-left: -12px;
        margin-right: -12px;
        padding-left: 14px;
        padding-right: 14px;
    }
    .transaction-card,
    .transaction-history-panel {
        border-left: 1px solid var(--line);
        border-right: 1px solid var(--line);
        border-radius: 18px;
        margin-left: 0;
        margin-right: 0;
    }
    .transaction-shortcuts { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .transaction-shortcuts button {
        min-height: 62px;
        padding: 8px 4px;
        gap: 5px;
        min-width: 0;
    }
    .transaction-shortcuts i {
        width: 28px;
        height: 28px;
        font-size: 14px;
    }
    .transaction-shortcuts span {
        font-size: 11px;
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .product-picker {
        grid-template-columns: 1fr;
    }
    .mobile-tabs {
        margin-left: -12px;
        margin-right: -12px;
        padding-left: 12px;
        padding-right: 12px;
        overflow-x: auto;
    }
    .mobile-tabs a, .mobile-tabs button { font-size: 12px; }
    .column-filters { grid-template-columns: 1fr; }
    .realtime-toast {
        right: 12px;
        bottom: 78px;
        left: 12px;
        max-width: none;
    }
}
