* { box-sizing: border-box; }
body {
    margin: 0;
    background: #f3f5f7;
    color: #15202b;
    font-family: Inter, "Segoe UI", Arial, sans-serif;
    line-height: 1.45;
}
.shell {
    width: min(1540px, calc(100% - 32px));
    margin: 0 auto;
    padding: 22px 0 40px;
}
.auth-screen {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}
.auth-screen[hidden],
.auth-panel[hidden],
.shell[hidden] {
    display: none;
}
.auth-panel {
    width: min(420px, 100%);
}
.auth-copy p {
    color: #5b6673;
    margin-bottom: 18px;
}
.auth-panel label {
    display: block;
    font-size: 12px;
    font-weight: 650;
    color: #425466;
    margin-bottom: 10px;
}
.auth-message {
    min-height: 18px;
    margin-top: 10px;
    color: #a52424;
    font-size: 13px;
    font-weight: 650;
}
.auth-message.success {
    color: #0f7a3b;
}
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 24px;
    padding: 8px 0 18px;
}
h1, h2, h3, p { margin-top: 0; }
h1 {
    font-size: 28px;
    line-height: 1.15;
    margin-bottom: 6px;
}
h2 {
    font-size: 18px;
    margin-bottom: 0;
}
h3 {
    font-size: 13px;
    color: #425466;
    margin: 18px 0 8px;
    text-transform: uppercase;
}
.topbar p {
    color: #5b6673;
    margin-bottom: 0;
}
.version {
    min-width: 64px;
    text-align: center;
    padding: 7px 10px;
    border: 1px solid #d8dee6;
    border-radius: 6px;
    background: #fff;
    color: #526071;
    font-size: 13px;
}
.topbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}
.current-user {
    padding: 7px 10px;
    border: 1px solid #d8dee6;
    border-radius: 6px;
    background: #fff;
    color: #526071;
    font-size: 13px;
    font-weight: 650;
}
.grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 16px;
    align-items: start;
}
.panel {
    background: #fff;
    border: 1px solid #d9e0e8;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
}
.panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}
.form-panel label {
    display: block;
    font-size: 12px;
    font-weight: 650;
    color: #425466;
    margin-bottom: 10px;
}
input, select, textarea {
    width: 100%;
    margin-top: 4px;
    padding: 7px 9px;
    border: 1px solid #cfd8e3;
    border-radius: 6px;
    background: #fff;
    color: #101820;
    font: inherit;
    font-size: 13px;
}
input, select {
    height: 36px;
}
textarea {
    min-height: 108px;
    resize: vertical;
    font-family: Consolas, "Courier New", monospace;
    line-height: 1.4;
}
.help-text {
    display: block;
    margin-top: 4px;
    color: #697586;
    font-size: 12px;
    font-weight: 500;
}
.datetime-pair {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 130px;
    gap: 8px;
    margin-top: 4px;
}
.datetime-pair input {
    margin-top: 0;
}
input[type="checkbox"] {
    width: 15px;
    height: 15px;
    margin: 0 6px 0 0;
    vertical-align: -2px;
}
.cols {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}
.cols.three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}
.checks, .chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    margin-bottom: 8px;
}
.checks label, .chips label {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: #253443;
}
.chips label {
    border: 1px solid #d8dee6;
    border-radius: 6px;
    padding: 7px 9px;
    background: #f8fafc;
}
.country-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}
.country-pair {
    display: grid;
    grid-template-columns: 1fr 76px;
    gap: 6px;
}
.country-pair.city-pair {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 76px;
}
.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
}
.button {
    min-height: 34px;
    border: 1px solid transparent;
    border-radius: 6px;
    padding: 7px 12px;
    cursor: pointer;
    font: inherit;
    font-size: 13px;
    font-weight: 700;
}
.button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}
.button-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}
.button-row.left {
    justify-content: flex-start;
}
.edit-state {
    margin: -4px 0 12px;
    padding: 8px 10px;
    border: 1px solid #d8dee6;
    border-radius: 6px;
    background: #f8fafc;
    color: #526071;
    font-size: 13px;
    font-weight: 650;
}
.edit-state.success {
    border-color: #9fd7b7;
    background: #f0fbf4;
    color: #0f7a3b;
}
.edit-state.error {
    border-color: #efb4b4;
    background: #fff5f5;
    color: #a52424;
}
.button.primary { background: #1769e0; color: #fff; }
.button.secondary { background: #fff; color: #1769e0; border-color: #b8c8dc; }
.button.danger { background: #a52424; color: #fff; }
.button.link-button {
    margin-top: 8px;
    padding-left: 0;
    padding-right: 0;
    border: 0;
    background: transparent;
    color: #1769e0;
}
.button.small { min-height: 28px; padding: 4px 8px; font-size: 12px; }
.profile-list {
    display: grid;
    gap: 10px;
}
.profile {
    border: 1px solid #d8dee6;
    border-radius: 8px;
    padding: 10px;
    background: #fbfcfe;
}
.profile-active {
    border-color: #1769e0;
    box-shadow: 0 0 0 2px rgba(23, 105, 224, 0.12);
}
.profile strong {
    display: block;
    margin-bottom: 3px;
}
.profile code {
    display: block;
    overflow-wrap: anywhere;
    color: #526071;
    font-size: 12px;
    margin-bottom: 8px;
}
.profile-actions {
    display: flex;
    gap: 8px;
}
.modal[hidden] { display: none; }
.modal {
    position: fixed;
    inset: 0;
    z-index: 30;
    display: grid;
    place-items: center;
    padding: 18px;
}
.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.42);
}
.modal-panel {
    position: relative;
    z-index: 1;
    width: min(460px, 100%);
    max-height: min(720px, calc(100vh - 36px));
    overflow: auto;
    margin: 0;
}
.table-wrap {
    width: 100%;
    overflow-x: auto;
}
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
th, td {
    padding: 9px 10px;
    border-bottom: 1px solid #e5e9ef;
    text-align: left;
    vertical-align: top;
}
th {
    color: #526071;
    font-size: 11px;
    text-transform: uppercase;
    background: #f8fafc;
}
td code {
    background: #f1f5f9;
    padding: 2px 4px;
    border-radius: 4px;
    overflow-wrap: anywhere;
}
.status-running { color: #0f7a3b; font-weight: 800; }
.status-stopped { color: #a52424; font-weight: 800; }
.status-completed { color: #435064; font-weight: 800; }
#refreshState {
    color: #5b6673;
    font-size: 13px;
}
.pager {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    color: #526071;
    font-size: 13px;
}
.pager button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}
@media (max-width: 980px) {
    .grid { grid-template-columns: 1fr; }
    .country-grid, .cols.three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
    .shell { width: min(100% - 20px, 1540px); }
    .topbar, .panel-head, .topbar-actions { align-items: stretch; flex-direction: column; }
    .cols, .cols.three, .country-grid, .datetime-pair { grid-template-columns: 1fr; }
}
