:root {
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: #282b31;
    background: #f5f5f2;
    font-synthesis: none;
    --red: #811f32;
    --muted: #74777e;
    --border: #e5e5df;
    --dark: #20272a
}

* {
    box-sizing: border-box
}

body {
    margin: 0
}

button,
input,
select {
    font: inherit
}

button {
    cursor: pointer
}

button:disabled {
    cursor: default;
    opacity: .45
}

button,
input,
select,
a {
    outline-offset: 4px
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible {
    outline: 2px solid var(--red)
}

[hidden] {
    display: none !important
}

a {
    color: inherit;
    text-decoration: none
}

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

.eyebrow {
    font-size: 10px;
    letter-spacing: 1.9px;
    font-weight: 700
}

.small,
small {
    font-size: 12px;
    line-height: 1.6
}

h1,
h2,
h3,
p {
    margin-top: 0
}

h1 {
    font-size: 36px;
    letter-spacing: -1.1px;
    font-weight: 650;
    margin-bottom: 10px
}

h2 {
    font-size: 23px;
    letter-spacing: -.6px
}

h3 {
    font-size: 14px
}

p {
    line-height: 1.6
}

.wordmark {
    font-size: 27px;
    letter-spacing: -1px;
    font-weight: 750;
    color: #fff;
    display: block
}

.wordmark span {
    font-weight: 350;
    color: #c9d0d0
}

.wordmark i {
    display: block;
    font-style: normal;
    font-size: 8px;
    letter-spacing: 3.4px;
    color: #aeb8b8;
    margin-top: 8px
}

.login-wrap {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 100dvh
}

.login-story {
    background: var(--dark);
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 52px 64px;
    position: relative;
    overflow: hidden
}

.login-story:after {
    content: '';
    position: absolute;
    right: -200px;
    bottom: -100px;
    width: 520px;
    height: 520px;
    border: 1px solid #ffffff0b;
    border-radius: 50%;
    box-shadow: 0 0 0 75px #ffffff03, 0 0 0 150px #ffffff02;
    pointer-events: none
}

.login-story h1 {
    font-size: 62px;
    line-height: 1.12;
    margin: 22px 0
}

.login-story p {
    color: #bdc5c5;
    max-width: 360px;
    font-size: 17px
}

.story-rule {
    width: 46px;
    height: 3px;
    background: #b67079;
    margin: 30px 0 20px
}

.story-caption,
.login-story small {
    color: #aab5b6;
    font-size: 12px
}

.login-main {
    display: grid;
    place-items: center;
    padding: 40px;
    background: #fbfbf9
}

.login-main form {
    width: 100%;
    max-width: 350px
}

.login-main h2 {
    font-size: 29px;
    margin: 17px 0 12px
}

.login-main label {
    margin-top: 25px
}

.login-main .primary {
    width: 100%;
    margin: 28px 0 12px;
    display: flex;
    justify-content: space-between
}

.login-main small {
    display: block;
    color: var(--muted)
}

label:not(.search) {
    display: block;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 9px
}

input:not([type=checkbox]),
select {
    background: #fff;
    border: 1px solid #dcded9;
    border-radius: 7px;
    padding: 12px;
    color: #333;
    width: 100%;
    min-height: 43px
}

input::placeholder {
    color: #969b9e
}

.primary,
.secondary {
    border-radius: 6px;
    padding: 11px 16px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid var(--border)
}

.primary {
    background: var(--red);
    border-color: var(--red);
    color: white
}

.primary:hover {
    background: #682034
}

.secondary {
    background: white;
    color: #50555a
}

.secondary:hover {
    background: #f3f3ee
}

.error {
    color: var(--red);
    font-size: 13px
}

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 235px;
    background: var(--dark);
    color: #c4cccd;
    padding: 34px 24px;
    display: flex;
    flex-direction: column
}

.sidebar .wordmark {
    padding-left: 12px
}

.sidebar-label {
    font-size: 8px;
    letter-spacing: 1.7px;
    margin: 56px 12px 20px;
    color: #8f9d9e
}

.nav-item {
    width: 100%;
    text-align: left;
    color: #b4bfc0;
    border: 0;
    background: transparent;
    padding: 14px 14px;
    border-radius: 6px;
    font-size: 12px;
    margin-bottom: 7px;
    display: flex;
    gap: 12px;
    align-items: center
}

.nav-item span {
    font-size: 20px
}

.nav-item.active {
    background: #3b4245;
    color: white;
    box-shadow: inset 3px 0 #c8818d
}

.sidebar-note {
    margin: auto 12px 28px;
    font-size: 11px;
    padding-top: 35px
}

.sidebar-note p {
    font-size: 11px;
    color: #8e9b9d;
    margin: 10px 0 0
}

.live-dot {
    width: 6px;
    height: 6px;
    background: #9bbab0;
    display: inline-block;
    border-radius: 50%;
    margin-right: 7px
}

.profile {
    border-top: 1px solid #ffffff12;
    padding-top: 22px;
    display: flex;
    align-items: center;
    gap: 10px
}

.avatar {
    border-radius: 9px;
    background: #4c5557;
    color: #e2e9e9;
    font-size: 12px;
    padding: 11px
}

.profile strong {
    font-size: 11px;
    font-weight: 500;
    display: block;
    color: white
}

.profile span {
    font-size: 9px;
    display: block;
    max-width: 114px;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 5px
}

.profile button {
    margin-left: auto;
    background: none;
    border: 0;
    color: #acb7b9;
    font-size: 20px
}

.main-area {
    margin-left: 235px
}

.topbar {
    background: #fbfbf9;
    height: 70px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 38px
}

.topbar>span {
    font-size: 9px;
    letter-spacing: 1.5px;
    color: #63686c;
    font-weight: 650
}

.topbar b {
    margin: 0 12px;
    color: #b6b9ba
}

.topbar>div {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 10px;
    color: #85898c
}

.icon-button {
    border: 1px solid var(--border);
    background: transparent;
    border-radius: 6px;
    width: 30px;
    height: 30px;
    font-size: 20px;
    color: #676e70
}

.content {
    padding: 37px 38px;
    max-width: 1600px;
    margin: auto
}

.page-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 4px 0 27px
}

.page-heading h1 {
    margin-top: 12px
}

.page-heading p {
    font-size: 12px;
    margin-bottom: 0
}

.scope-label {
    border: 1px solid #dcded6;
    border-radius: 20px;
    background: #fff;
    padding: 9px 12px;
    font-size: 10px;
    color: #6b726b
}

.stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-bottom: 28px
}

.stat {
    padding: 21px 22px;
    text-align: left;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: #fff;
    transition: transform .15s
}

.stat:hover {
    transform: translateY(-2px)
}

.stat>span {
    font-size: 11px;
    color: #656c70
}

.stat strong {
    font-size: 32px;
    font-weight: 550;
    letter-spacing: -1px;
    display: block;
    margin: 15px 0 8px
}

.stat small {
    color: #92979a;
    font-size: 10px
}

.stat.attention {
    background: #fcf6f5;
    border-color: #ebd8d8
}

.stat.attention strong {
    color: var(--red)
}

.orders-panel {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 9px;
    overflow: hidden
}

.panel-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    padding: 0 22px
}

.tabs {
    display: flex;
    gap: 22px
}

.tabs button {
    background: none;
    border: 0;
    padding: 20px 0 16px;
    border-bottom: 2px solid transparent;
    font-size: 11px;
    color: #878c8f
}

.tabs button.selected {
    color: var(--red);
    border-bottom-color: var(--red);
    font-weight: 650
}

#result-count {
    font-size: 10px
}

.filters {
    padding: 18px 22px;
    display: flex;
    gap: 10px
}

.filters select {
    width: auto;
    max-width: 180px;
    min-width: 0;
    flex: 1;
    font-size: 11px;
    background: #fbfbf9;
    padding: 9px;
    min-height: 38px
}

.search {
    display: flex;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: 6px;
    min-width: 140px;
    flex: 2;
    padding-left: 10px;
    color: #92999a
}

.search input {
    border: 0 !important;
    min-height: 36px !important;
    font-size: 11px;
    background: none !important;
    min-width: 0
}

.search span {
    font-size: 22px
}

.table-scroll {
    overflow: auto
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    white-space: nowrap
}

thead {
    background: #f9faf7;
    color: #8a8e90
}

th {
    font-size: 9px;
    font-weight: 550;
    letter-spacing: .4px;
    padding: 14px 22px
}

td {
    padding: 19px 22px;
    border-top: 1px solid #f0f0ec;
    font-size: 11px;
    color: #535a60
}

td strong {
    display: block;
    font-size: 12px;
    font-weight: 650;
    color: #353c42
}

td small {
    display: block;
    font-size: 9px;
    color: #8a9195;
    margin-top: 6px
}

.order-link {
    border: 0;
    background: none;
    color: #333;
    font-weight: 650;
    padding: 3px 0;
    text-decoration: underline;
    text-decoration-color: #ccc;
    text-underline-offset: 4px
}

.badge {
    display: inline-block;
    border-radius: 5px;
    padding: 6px 8px;
    font-size: 10px;
    font-weight: 550;
    background: #eef2f3;
    color: #526770
}

.badge.failed {
    background: #fbebea;
    color: #a14e48
}

.badge.pending {
    background: #fcf4e3;
    color: #9a7836
}

.badge.confirmed {
    background: #eaf3ed;
    color: #52775a
}

.badge.scheduled {
    background: #f0edf7;
    color: #7c669e
}

.badge.closed {
    background: #f0f0ee;
    color: #7c827f
}

.row-arrow {
    border: 0;
    background: transparent;
    font-size: 18px;
    color: #92999c
}

.table-footer {
    padding: 16px 22px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px
}

.table-footer span {
    font-size: 10px
}

.table-footer button {
    padding: 7px 10px;
    font-size: 10px
}

.source-panel {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    margin-top: 27px;
    padding: 18px 0;
    border-bottom: 1px solid var(--border)
}

.source-panel h3 {
    font-size: 11px;
    margin-bottom: 6px
}

.source-panel p {
    font-size: 10px;
    color: #8a9091;
    margin: 0
}

.source-row {
    font-size: 10px;
    color: #6d7578;
    margin-bottom: 9px
}

.source-row .warning {
    color: #a47838
}

.empty {
    padding: 55px 20px;
    text-align: center;
    color: #8a9091;
    font-size: 12px
}

.empty h3 {
    color: #60696b;
    margin: 12px 0
}

.empty p {
    margin: 0
}

.empty-icon {
    font-size: 32px;
    color: #9da9a7
}

.notice {
    font-size: 11px;
    padding: 12px 15px;
    background: #f8f0dc;
    border: 1px solid #ecdfbb;
    color: #8b713b;
    border-radius: 7px;
    margin-bottom: 20px;
    line-height: 1.5
}

.active-filter {
    margin: 0 22px 16px;
    font-size: 11px;
    color: var(--red)
}

.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px
}

.settings-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 9px;
    padding: 27px
}

.settings-card h2 {
    font-size: 18px
}

.settings-card p {
    font-size: 12px;
    color: #737b7e
}

.settings-card button {
    margin: 8px 5px 10px 0
}

.settings-card label {
    margin-top: 17px
}

.check {
    display: flex !important;
    align-items: center;
    gap: 10px
}

.check input {
    accent-color: var(--red);
    width: 17px;
    height: 17px
}

.saved-pref {
    padding: 13px 0;
    border-top: 1px solid var(--border);
    font-size: 11px;
    line-height: 1.7
}

.saved-pref strong {
    display: block
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0)
}

#toast {
    position: fixed;
    bottom: 25px;
    right: 25px;
    background: #2e393a;
    color: white;
    border-radius: 8px;
    padding: 16px 22px;
    max-width: min(400px, 90vw);
    box-shadow: 0 5px 30px #0002;
    font-size: 13px;
    z-index: 20
}

dialog {
    border: 0;
    border-radius: 12px;
    padding: 25px;
    width: 600px;
    max-width: calc(100vw - 24px);
    max-height: 90dvh;
    box-shadow: 0 20px 90px #0003
}

dialog::backdrop {
    background: #15212766;
    backdrop-filter: blur(2px)
}

.detail-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px
}

.detail-top button {
    background: none;
    border: 0;
    color: #7f8889;
    font-size: 27px
}

.detail-heading {
    display: flex;
    justify-content: space-between;
    align-items: center
}

.detail-heading h2 {
    margin: 0
}

.detail-subtitle {
    font-size: 12px;
    color: #7b8587;
    margin: 12px 0 25px
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    padding: 20px;
    background: #f7f8f4;
    border-radius: 8px;
    margin-bottom: 25px
}

.detail-grid small {
    color: #8c9596;
    display: block;
    font-size: 10px
}

.detail-grid strong {
    font-size: 12px;
    font-weight: 550;
    display: block;
    margin-top: 6px
}

.item-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #eee;
    font-size: 12px
}

.timeline {
    list-style: none;
    padding: 0;
    margin: 0 0 25px
}

.timeline li {
    padding: 12px 0 12px 15px;
    border-left: 2px solid #e4e8e2;
    font-size: 12px
}

.timeline small {
    display: block;
    font-size: 10px;
    color: #92999a;
    margin-top: 4px
}

.detail-section {
    margin: 25px 0 12px;
    font-size: 13px
}

.action-box {
    border-top: 1px solid var(--border);
    padding-top: 20px
}

.action-box p {
    font-size: 11px;
    color: #7f8888
}

.action-box button {
    margin: 12px 7px 0 0
}

.result-message {
    font-size: 12px;
    color: #52775a;
    margin-top: 12px
}

@media(min-width:1500px) {
    .content {
        padding-top: 48px
    }

    .stats {
        gap: 22px
    }

    .stat {
        padding: 27px
    }

    .sidebar {
        width: 255px
    }

    .main-area {
        margin-left: 255px
    }
}

@media(max-width:1100px) {
    .sidebar {
        width: 205px;
        padding: 30px 17px
    }

    .main-area {
        margin-left: 205px
    }

    .content {
        padding: 28px 24px
    }

    .topbar {
        padding: 0 24px
    }

    .filters {
        flex-wrap: wrap
    }

    .search {
        flex-basis: 100%
    }

    .stat {
        padding: 16px
    }

    .stat small {
        font-size: 9px
    }

    th,
    td {
        padding-left: 15px;
        padding-right: 15px
    }

    .login-story {
        padding: 40px
    }

    .login-story h1 {
        font-size: 48px
    }
}

@media(max-width:760px) {
    .login-wrap {
        display: block
    }

    .login-story {
        min-height: 230px;
        padding: 25px
    }

    .login-story h1 {
        font-size: 32px;
        margin: 18px 0 0
    }

    .login-story>div .eyebrow,
    .login-story p,
    .story-rule,
    .story-caption,
    .login-story small {
        display: none
    }

    .login-main {
        padding: 35px 25px;
        min-height: calc(100dvh - 230px)
    }

    .sidebar {
        position: static;
        width: auto;
        padding: 16px 20px;
        display: grid;
        grid-template-columns: 1fr auto;
        gap: 14px
    }

    .sidebar .wordmark {
        font-size: 22px;
        padding: 0
    }

    .sidebar .wordmark i {
        font-size: 7px;
        margin-top: 4px
    }

    .sidebar-label,
    .sidebar-note,
    .profile .avatar,
    .profile strong {
        display: none
    }

    .sidebar nav {
        grid-row: 2;
        grid-column: 1/-1;
        display: flex;
        gap: 10px
    }

    .nav-item {
        padding: 8px 12px;
        font-size: 11px;
        width: auto;
        margin: 0
    }

    .nav-item span {
        font-size: 16px
    }

    .profile {
        border: 0;
        padding: 0;
        gap: 8px
    }

    .profile span {
        font-size: 9px;
        max-width: 140px
    }

    .main-area {
        margin-left: 0
    }

    .topbar {
        padding: 0 20px;
        height: 50px
    }

    .topbar>span {
        font-size: 7px;
        letter-spacing: .8px
    }

    .topbar b {
        margin: 0 6px
    }

    .topbar>div {
        font-size: 9px;
        gap: 7px
    }

    .content {
        padding: 24px 16px
    }

    .page-heading {
        align-items: start;
        gap: 10px
    }

    .page-heading h1 {
        font-size: 29px
    }

    .page-heading p {
        font-size: 11px;
        max-width: 245px
    }

    .scope-label {
        font-size: 8px;
        padding: 7px;
        max-width: 100px;
        line-height: 1.5
    }

    .stats {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
        margin-bottom: 20px
    }

    .stat {
        padding: 15px
    }

    .stat strong {
        font-size: 28px;
        margin: 8px 0 5px
    }

    .stat span {
        font-size: 10px
    }

    .panel-top {
        padding: 0 14px
    }

    .tabs {
        gap: 15px
    }

    .tabs button {
        font-size: 10px;
        padding-top: 17px
    }

    #result-count {
        font-size: 9px
    }

    .filters {
        padding: 14px;
        gap: 8px
    }

    .filters select {
        font-size: 10px;
        flex-basis: 28%;
        width: 0;
        max-width: none;
        padding: 8px 3px
    }

    th,
    td {
        padding: 14px 12px
    }

    th:nth-child(4),
    td:nth-child(4),
    th:nth-child(5),
    td:nth-child(5) {
        display: none
    }

    td strong {
        font-size: 11px
    }

    td,
    td .badge {
        font-size: 9px
    }

    td:last-child {
        padding: 7px
    }

    .table-footer {
        padding: 12px;
        flex-wrap: wrap
    }

    .table-footer button {
        padding: 7px;
        font-size: 9px
    }

    .source-panel {
        flex-direction: column;
        gap: 15px
    }

    .settings-grid {
        grid-template-columns: 1fr
    }

    .settings-card {
        padding: 20px
    }

    .notice {
        font-size: 10px
    }

    .detail-grid {
        padding: 15px;
        gap: 15px
    }

    dialog {
        padding: 20px
    }

    .profile button {
        font-size: 18px
    }
}

@media(prefers-reduced-motion:reduce) {
    * {
        transition: none !important
    }
}

/* Keep long production branch names inside the mobile table. */
.table-scroll { position: relative; }
@media (max-width: 760px) {
    #orders-table { table-layout: fixed; }
    #orders-table th, #orders-table td { white-space: normal; overflow-wrap: anywhere; }
    #orders-table th:nth-child(1) { width: 24%; }
    #orders-table th:nth-child(2) { width: 35%; }
    #orders-table th:nth-child(3) { width: 31%; }
    #orders-table th:last-child { width: 10%; }
    #orders-table td:last-child { padding: 4px; }
    #orders-table .row-arrow { width: 18px; padding: 0; }
}
