* {
    box-sizing: border-box;
}

body {
    font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
    margin: 0;
    padding: 1rem 1.25rem;
    background: #1a1d23;
    color: #e8eaed;
}

/* Show / control / edit: keep chrome fixed, scroll only the schedule table */
body.page-scroll-contained {
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

body.page-scroll-contained .page-frame {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

body.page-scroll-contained .schedule-scroll {
    flex: 1;
    min-height: 0;
    overflow: auto;
    overscroll-behavior: contain;
    border: 1px solid #3c4043;
    border-radius: 8px;
    background: #1a1d23;
}

#schedule-root.control-schedule-updating {
    opacity: 0.88;
    transition: opacity 0.1s ease;
}

body.page-scroll-contained .schedule-scroll .schedule-table {
    margin: 0;
}

body.page-scroll-contained .schedule-scroll .schedule-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    box-shadow: 0 1px 0 #3c4043;
}

a {
    color: #8ab4f8;
}

header.page-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.75rem 1.5rem;
    margin-bottom: 1rem;
}

h1 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
}

.clock {
    font-size: 2rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.02em;
}

.sub {
    color: #9aa0a6;
    font-size: 0.9rem;
}

header.page-head--split {
    flex-wrap: nowrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.page-head-left {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.75rem 1.5rem;
}

.page-head-right {
    margin-left: auto;
    flex-shrink: 0;
    padding-top: 0.2rem;
}

.timing-slip {
    display: inline-block;
    font-weight: 600;
    font-size: 0.95rem;
    padding: 0.35rem 0.65rem;
    border-radius: 6px;
    white-space: nowrap;
}

.timing-slip--ahead {
    background: #1e3a2f;
    color: #81c995;
}

.timing-slip--behind {
    background: #3c1f1f;
    color: #f28b82;
}

.timing-slip--neutral {
    background: #30343a;
    color: #9aa0a6;
}

.dialog-pop {
    border: 1px solid #5f6368;
    border-radius: 10px;
    padding: 1rem 1.25rem;
    max-width: 28rem;
    background: #252830;
    color: #e8eaed;
}

.dialog-pop::backdrop {
    background: rgba(0, 0, 0, 0.55);
}

.dialog-pop-lead {
    margin-top: 0;
}

.dialog-pop-actions {
    margin-bottom: 0;
}

/* Reusable share hub (dialog): label | scrollable URL | copy */
.share-hub-dialog {
    max-width: 38rem;
    width: calc(100vw - 2rem);
    padding: 1rem 1.15rem 1.1rem;
}

.share-hub-dialog__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.35rem;
}

.share-hub-dialog__title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.share-hub-dialog__close {
    padding: 0.15rem 0.45rem;
    line-height: 1.2;
    font-size: 1.25rem;
}

.share-hub-dialog__lead {
    margin: 0 0 0.75rem 0;
    font-size: 0.88rem;
}

.share-hub-dialog__actions {
    margin: 0.75rem 0 0 0;
    text-align: right;
}

.share-hub-row {
    display: grid;
    grid-template-columns: minmax(5.5rem, 8rem) minmax(0, 1fr) auto;
    gap: 0.45rem 0.65rem;
    align-items: center;
    padding: 0.55rem 0;
    border-bottom: 1px solid #3c4043;
}

.share-hub-row:last-child {
    border-bottom: none;
}

.share-hub-row__label {
    font-size: 0.8rem;
    color: #bdc1c6;
    line-height: 1.25;
}

.share-hub-row__url-wrap {
    min-width: 0;
    max-width: 100%;
    overflow-x: auto;
    padding: 0.35rem 0.45rem;
    background: #1a1d23;
    border-radius: 6px;
    border: 1px solid #3c4043;
    -webkit-overflow-scrolling: touch;
}

.share-hub-row__url {
    display: block;
    font-size: 0.72rem;
    white-space: nowrap;
    word-break: normal;
}

.share-hub-row__copy {
    flex-shrink: 0;
    white-space: nowrap;
    padding: 0.3rem 0.55rem;
    font-size: 0.8rem;
}

.share-toast {
    position: fixed;
    z-index: 9999;
    bottom: 1.25rem;
    left: 50%;
    transform: translate3d(-50%, 120%, 0);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    background: #30343a;
    border: 1px solid #5f6368;
    color: #e8eaed;
    font-size: 0.9rem;
    font-weight: 600;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
    transition: transform 0.22s ease, opacity 0.22s ease;
    opacity: 0;
    pointer-events: none;
}

.share-toast--visible {
    transform: translate3d(-50%, 0, 0);
    opacity: 1;
}

/* Index landing */
.home-shell {
    max-width: 32rem;
    margin: 0 auto;
}

.home-hero {
    margin-bottom: 1.5rem;
}

.home-hero h1 {
    margin: 0 0 0.35rem 0;
}

.home-hero .sub {
    margin: 0;
    font-size: 0.95rem;
}

.home-card {
    background: #252830;
    border: 1px solid #3c4043;
    border-radius: 10px;
    padding: 1rem 1.15rem 1.15rem;
    margin-bottom: 1rem;
}

.home-card h2 {
    margin: 0 0 0.75rem 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: #bdc1c6;
}

.home-card .stack {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.home-card label {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.home-card input[type="text"],
.home-card input[type="password"] {
    width: 100%;
}

.home-input-code {
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.home-code {
    display: inline-block;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.95em;
    letter-spacing: 0.08em;
    background: #30343a;
    padding: 0.2rem 0.55rem;
    border-radius: 6px;
    border: 1px solid #5f6368;
}

.home-hub-actions {
    margin-top: 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.edit-bulk-hint {
    margin: 0 0 0.5rem 0;
    max-width: 48rem;
}

.toolbar-bulk-wrap {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.toolbar-gap-wrap {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.edit-toolbar--twoline {
    flex-direction: column;
    align-items: stretch;
    flex-wrap: nowrap;
    gap: 0.35rem;
    margin-bottom: 0.5rem;
    padding: 0.5rem 0.65rem;
}

.edit-tb-line {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.edit-tb-status-line {
    min-height: 1.2em;
}

.bulk-add-label {
    font-size: 0.875rem;
    color: #bdc1c6;
}

.schedule-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.schedule-table th,
.schedule-table td {
    border: 1px solid #3c4043;
    padding: 0.45rem 0.55rem;
    text-align: left;
    vertical-align: top;
}

.schedule-table thead th {
    background: #30343a;
    font-weight: 600;
}

/* Live schedule: duration columns + slip (Delay). */
.schedule-table .schedule-th-numeric,
.schedule-table .schedule-col-actual,
.schedule-table .schedule-col-planned,
.schedule-table .schedule-col-delay {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.schedule-table thead .schedule-th-numeric {
    text-align: right;
}

.schedule-table .schedule-col-delay--behind {
    color: #f28b82;
    font-weight: 600;
}

.schedule-table .schedule-col-delay--ahead {
    color: #81c995;
    font-weight: 600;
}

.schedule-table .skip-hint {
    color: #9aa0a6;
    font-size: 0.85em;
}

.schedule-table .active-hint {
    color: #8ab4f8;
}

.schedule-table--live .schedule-cell-text {
    max-width: 14rem;
    font-size: 0.85rem;
    white-space: pre-wrap;
    word-break: break-word;
}

.schedule-table--live .schedule-th-action {
    white-space: nowrap;
    width: 1%;
}

.schedule-table--live .schedule-cell-action {
    white-space: nowrap;
    vertical-align: middle;
}

.schedule-table--live .schedule-focus-form {
    display: inline;
    margin: 0;
}

.schedule-table--live .schedule-focus-btn {
    padding: 0.25rem 0.45rem;
    font-size: 0.8rem;
}

.row-passed {
    background: #23262c;
    color: #6f7378;
}

.row-pending {
    background: #1e2838;
    color: #b8c5d9;
    box-shadow: inset 3px 0 0 0 #4a607c;
}

.row-current-ok {
    background: #3d3419;
    outline: 2px solid #f9ab00;
}

.row-current-delay {
    background: #3c1f1f;
    outline: 2px solid #ea4335;
}

.row-focus {
    box-shadow: inset 0 0 0 2px #8ab4f8;
}

.row-skipped td {
    opacity: 0.75;
    font-style: italic;
}

.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: #252830;
    border-radius: 8px;
}

.toolbar form {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.control-toolbar.control-toolbar--grouped {
    align-items: stretch;
    gap: 0.75rem 1rem;
}

.control-toolbar__group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 0.45rem 0.65rem 0.55rem;
    border: 1px solid #3c4043;
    border-radius: 8px;
    background: #202227;
    min-width: 0;
}

.control-toolbar__group-title {
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #9aa0a6;
    line-height: 1.2;
}

.control-toolbar__group-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem 0.55rem;
}

.operator-bar--grouped {
    align-items: flex-end;
    gap: 0.75rem 1rem;
}

.operator-bar__group {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    padding: 0.4rem 0.6rem 0.5rem;
    border: 1px solid #3c4043;
    border-radius: 8px;
    background: #202227;
}

.operator-bar__group-title {
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #9aa0a6;
}

.operator-bar__group-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem 0.5rem;
}

.page-head-right--tools {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.45rem 0.6rem;
}

.edit-ripple-form {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin: 0;
}

.edit-ripple-form label {
    margin: 0;
    font-size: 0.8rem;
}

button,
.btn {
    cursor: pointer;
    border: 1px solid #5f6368;
    background: #3c4043;
    color: #e8eaed;
    padding: 0.35rem 0.65rem;
    border-radius: 6px;
    font-size: 0.875rem;
}

button.primary,
.btn.primary {
    background: #1a73e8;
    border-color: #1a73e8;
}

button.danger {
    background: #5c1f1f;
    border-color: #c5221f;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="time"],
select,
textarea {
    background: #30343a;
    border: 1px solid #5f6368;
    color: #e8eaed;
    padding: 0.35rem 0.5rem;
    border-radius: 6px;
    font-size: 0.875rem;
}

label {
    font-size: 0.875rem;
    color: #bdc1c6;
}

.operator-bar {
    position: sticky;
    bottom: 0;
    margin-top: 1.25rem;
    padding: 0.75rem;
    background: #252830;
    border-radius: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.flash {
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    background: #174ea6;
}

.flash.err {
    background: #5c1f1f;
}

#edit-status.err {
    color: #f28b82;
}

.stack {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.edit-table input[type="text"],
.edit-table textarea {
    width: 100%;
    min-width: 6rem;
}

.edit-table textarea {
    min-height: 2.5rem;
    resize: vertical;
}

.edit-table .narrow {
    width: 5rem;
}
