:root {
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
    color: #192c3d;
    background: #f4f7fb;
    font-synthesis: none
}

* {
    box-sizing: border-box
}

body {
    margin: 0;
    line-height: 1.45
}

.container {
    width: min(1150px, calc(100% - 32px));
    margin: auto
}

.topbar {
    background: #12304a;
    color: white
}

.topbar-inner {
    min-height: 76px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px
}

.brand {
    display: flex;
    align-items: center;
    gap: 13px
}

.brand strong {
    display: block;
    font-size: 1.35rem;
    letter-spacing: -.4px
}

.brand small {
    display: block;
    color: #b9d2e2;
    font-size: .76rem
}

.brand-icon {
    width: 48px;
    height: 48px;
    flex-shrink: 0
}

.license-actions {
    flex-wrap: wrap
}

.intro {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 29px 0 18px
}

h1 {
    font-size: clamp(1.55rem, 3vw, 2.2rem);
    line-height: 1.17;
    letter-spacing: -.65px;
    margin: 0 0 10px
}

h2 {
    font-size: 1.17rem;
    margin: 0 0 4px
}

h3 {
    font-size: 1rem;
    margin: 0 0 7px
}

.muted {
    color: #607383;
    margin: 0
}

.small {
    font-size: .85rem
}

.settings-button {
    flex: 0 0 auto;
    line-height: 0
}

.lan-settings {
    display: grid;
    gap: 8px;
    padding-top: 12px;
    border-top: 1px solid #e5ebf0
}

.lan-actions {
    flex-wrap: wrap
}

#lanFolder, #lanFeedback, #monitorStatus {
    overflow-wrap: anywhere
}

#monitorStatus.muted {
    margin-bottom: 14px
}

.settings-content {
    display: grid;
    gap: 10px;
    padding: 24px
}

#editEndField[hidden] {
    display: none
}

.intro-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
    flex-shrink: 0
}

button,
input,
select,
textarea {
    font: inherit
}

button {
    cursor: pointer;
    border-radius: 9px;
    font-weight: 700;
    border: 1px solid transparent;
    padding: 11px 15px
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: 3px solid #75b7d3;
    outline-offset: 2px
}

.primary {
    background: #176a89;
    color: #fff
}

.primary:hover {
    background: #0e5572
}

.secondary {
    background: #fff;
    color: #29506c;
    border: 1px solid #cddae4
}

.secondary:hover {
    background: #eff6fa
}

.text-btn {
    background: none;
    color: #206783;
    padding: 5px;
    font-size: .85rem
}

.notice {
    background: #fff8e8;
    border: 1px solid #eedbb0;
    border-radius: 11px;
    padding: 12px 15px;
    font-size: .83rem;
    color: #655021;
    margin-bottom: 17px
}

.stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 17px
}

.stat,
.panel {
    background: #fff;
    border: 1px solid #e2e9ef;
    border-radius: 14px;
    box-shadow: 0 3px 13px #1b395008
}

.stat {
    padding: 18px
}

.stat span {
    display: block;
    color: #63788a;
    font-size: .85rem
}

.stat strong {
    display: block;
    font-size: 1.8rem;
    line-height: 1.45;
    letter-spacing: -.6px
}

.workspace {
    display: grid;
    margin-bottom: 24px;
    grid-template-columns: minmax(0, 2.1fr) minmax(260px, 1fr);
    gap: 17px;
    align-items: start
}

.panel {
    padding: 20px
}

.panel-heading {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    align-items: flex-start;
    margin-bottom: 18px
}

.panel-heading p {
    font-size: .84rem
}

.filters {
    display: grid;
    grid-template-columns: 1fr 1fr 1.3fr;
    gap: 10px;
    margin-bottom: 17px
}

.filters label,
.machine-filter,
dialog label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: .79rem;
    color: #425e70;
    font-weight: 700
}

input,
select,
textarea {
    min-width: 0;
    width: 100%;
    border: 1px solid #cdd9e2;
    border-radius: 8px;
    padding: 10px 11px;
    background: #fff;
    color: #1b3447
}

.machine-filter {
    min-width: 0
}

#machineFilter {
    position: relative
}

#machineFilterSummary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    cursor: pointer;
    list-style: none;
    border: 1px solid #cdd9e2;
    border-radius: 8px;
    padding: 10px 11px;
    background: #fff;
    color: #1b3447
}

#machineFilterSummary::after {
    content: "⌄"
}

#machineFilterLabel {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap
}

.machine-filter-popover {
    position: absolute;
    z-index: 2;
    inset: calc(100% + 4px) auto auto 0;
    width: max(100%, 12rem);
    max-width: 55vw;
    background: #fff;
    border: 1px solid #cdd9e2;
    border-radius: 8px;
    box-shadow: 0 6px 18px #192c3d26;
    padding: 8px
}

#machineFilterOptions {
    max-height: 220px;
    overflow: auto
}

.filters .machine-filter-option {
    flex-direction: row;
    align-items: center;
    padding: 5px;
    cursor: pointer;
    overflow-wrap: anywhere
}

.machine-filter-option input {
    width: auto;
    flex-shrink: 0
}

textarea {
    resize: vertical
}

.entries {
    display: grid;
    gap: 10px
}

.entry {
    border: 1px solid #e0e9f0;
    border-radius: 11px;
    padding: 13px 14px
}

.entry-top,
.entry-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px
}

.entry-top {
    margin-bottom: 8px
}

.entry h3 {
    font-size: .97rem;
    margin: 0
}

.entry p {
    margin: 5px 0 10px;
    color: #42586b;
    font-size: .88rem;
    overflow-wrap: anywhere
}

.entry-bottom {
    font-size: .78rem;
    color: #62788a;
    flex-wrap: wrap
}

.chip {
    display: inline-block;
    border-radius: 6px;
    padding: 4px 8px;
    font-weight: 750;
    font-size: .7rem;
    white-space: nowrap
}

.chip.open {
    background: #fff0d7;
    color: #875b0f
}

.chip.closed {
    background: #e6f6ed;
    color: #177046
}

.entry-actions {
    display: flex;
    gap: 7px;
    align-items: center
}

.small-btn {
    font-size: .74rem;
    padding: 7px 9px;
    border: 1px solid #cbdbe5;
    background: #f4f9fc;
    color: #1e5771
}

.danger-btn {
    background: transparent;
    border: 0;
    color: #a94246;
    font-size: .74rem;
    padding: 7px
}

.machine-list {
    display: grid;
    gap: 9px;
    margin-top: 15px
}

.machine {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 9px;
    padding: 10px 12px;
    background: #f3f7fa;
    border-radius: 9px;
    font-size: .88rem
}

.machine-label {
    display: grid;
    min-width: 0;
    gap: 2px;
    overflow-wrap: anywhere
}

.machine small {
    color: #60768b
}

.empty {
    text-align: center;
    padding: 25px;
    color: #64798a
}

dialog {
    border: 0;
    border-radius: 16px;
    padding: 0;
    width: min(470px, calc(100% - 28px));
    max-height: 90vh;
    box-shadow: 0 20px 60px #162f4766
}

#machineManager {
    width: min(570px, calc(100% - 28px));
    padding: clamp(16px, 4vw, 24px)
}

.machine-manager-actions {
    margin: 14px 0
}

dialog::backdrop {
    background: #102a3cab
}

dialog form {
    padding: 24px;
    display: grid;
    gap: 16px
}

.dialog-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px
}

.close {
    font-size: 1.6rem;
    color: #667b89;
    background: transparent;
    padding: 0 6px;
    line-height: 1
}

.dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 2px
}

.error {
    padding: 9px 10px;
    background: #fcebec;
    border-radius: 6px;
    color: #9b2632;
    font-size: .84rem;
    margin: 0
}

@media(max-width:850px) {
    .workspace {
        grid-template-columns: 1fr
    }

    .stats {
        grid-template-columns: repeat(2, 1fr)
    }

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

    .intro-actions {
        width: 100%
    }

    .intro-actions button:not(.settings-button) {
        flex: 1
    }
}

@media(max-width:530px) {
    .container {
        width: calc(100% - 22px)
    }

    .topbar-inner {
        min-height: 66px
    }

    .intro {
        padding-top: 21px
    }

    .intro-actions {
        gap: 7px
    }

    .intro-actions button {
        padding: 10px 8px;
        font-size: .86rem
    }

    .stats {
        gap: 8px
    }

    .stat {
        padding: 12px
    }

    .stat span {
        font-size: .76rem
    }

    .stat strong {
        font-size: 1.45rem
    }

    .panel {
        padding: 13px
    }

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

    .machine-filter-popover {
        inset-inline-start: auto;
        inset-inline-end: 0
    }

    .filters > label:last-child {
        grid-column: 1/-1
    }

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

    .dialog-actions button {
        flex: 1
    }

    dialog form {
        padding: 19px
    }
}