* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--canvas);
    color: var(--navy-950);
    font-family: var(--perfect-picker-font-family);
}

.page {
    width: calc(100% - 32px);
    margin: 0 auto;
    padding: 28px 0 48px;
}

.page-heading {
    margin-bottom: 24px;
}

.page-heading p {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 14px;
}

h1, h2, h3 {
    margin: 0;
    letter-spacing: 0;
}

h1 {
    font-size: 28px;
}

h2 {
    margin-bottom: 12px;
    font-size: 18px;
}

h3 {
    margin-bottom: 12px;
    font-size: 17px;
}

.nav {
    display: flex;
    align-items: center;
    gap: 12px;
}

a {
    color: var(--blue-700);
    font-weight: 700;
    text-decoration: none;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
}

.db-group {
    margin-bottom: 12px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: var(--surface);
    overflow: hidden;
}

.db-group > h2 {
    margin: 0;
    padding: 8px 10px;
    color: var(--navy-800);
    background: #e9eef6;
    border-bottom: 1px solid #b8c5d6;
    font-size: 14px;
}

.db-group .panel {
    margin-bottom: 0;
}

.panel {
    margin-bottom: 16px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: 0 8px 20px rgba(31, 54, 85, 0.04);
}

.panel p {
    margin: 0 0 16px;
    line-height: 1.6;
}

.cron-status-panel {
    border-color: var(--line);
    background: var(--surface);
    padding: 0;
    border-radius: 4px;
    box-shadow: none;
}

.cron-status-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0;
    padding: 8px 10px;
    background: #e9eef6;
    border-bottom: 1px solid #b8c5d6;
}

.cron-status-header h2 {
    margin-bottom: 0;
}

.cron-badge {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
}

.cron-badge.running {
    background: #fff5f5;
    color: #b42318;
}

.cron-badge.idle {
    background: #eef8f1;
    color: #177245;
}

.cron-status-body {
    display: grid;
    grid-template-columns: minmax(180px, 0.7fr) minmax(260px, 1.3fr);
    gap: 0;
    color: var(--navy-800);
    font-size: 13px;
}

.cron-status-body > div {
    min-width: 0;
    padding: 8px 10px;
    border: 0;
    border-right: 1px solid #c7d1df;
    border-radius: 0;
    background: var(--surface);
}

.cron-status-body > div:last-child {
    border-right: 0;
}

.cron-status-body strong {
    display: block;
    margin-bottom: 6px;
}

.cron-status-body small {
    display: block;
    margin-top: 4px;
    color: var(--muted);
}

.cron-job-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.cron-job-list li + li {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #eef2f5;
}

.cron-card-status {
    margin: 0 0 14px;
    padding: 9px 11px;
    border: 1px solid #efb4b4;
    border-radius: 6px;
    background: #fff5f5;
    color: #b42318;
    font-size: 12px;
    line-height: 1.5;
}

.cron-card-status span {
    display: block;
    margin-bottom: 3px;
    font-size: 13px;
    font-weight: 800;
}

.danger {
    border-color: #e7b8b8;
    background: #fff7f7;
}

.muted {
    color: var(--muted);
    background: #f8fafd;
}

.update-status {
    margin: 0 0 14px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #f8fafd;
    color: #4d627f;
    font-size: 12px;
    line-height: 1.55;
}

.update-status-title {
    margin-bottom: 4px;
    font-size: 13px;
    font-weight: 800;
}

.update-status.need {
    border-color: #efb4b4;
    background: #fff5f5;
    color: #b42318;
}

.update-status.ok {
    border-color: #b8d8c2;
    background: #f2fbf5;
    color: #177245;
}

.update-status.wait {
    border-color: #d8c78b;
    background: #fff9e8;
    color: #7a5a00;
}

form {
    margin: 0;
}

label {
    display: block;
    margin-bottom: 12px;
    font-size: 13px;
    font-weight: 700;
}

input[type="text"],
input[type="password"],
input[type="number"] {
    display: block;
    width: 100%;
    margin-top: 6px;
    padding: 9px 10px;
    color: var(--navy-950);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 6px;
    font: inherit;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="number"]:focus {
    border-color: #7e9dca;
    outline: none;
    box-shadow: 0 0 0 3px rgba(35, 88, 165, 0.12);
}

.check {
    display: flex;
    align-items: center;
    gap: 8px;
}

button {
    min-height: 36px;
    padding: 7px 14px;
    border: 1px solid var(--blue-700);
    border-radius: 6px;
    background: var(--blue-700);
    color: #fff;
    font-weight: 700;
    cursor: pointer;
}

button:not([disabled]):hover {
    background: #174986;
}

button[disabled] {
    border-color: #b6c1cc;
    background: #c6d0da;
    cursor: not-allowed;
}

.nav button {
    border-color: var(--line);
    background: var(--surface);
    color: var(--navy-950);
}

.action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.secondary-button {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 7px 14px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface);
    color: #435a78;
    font-size: 13px;
    font-weight: 700;
}

.view-menu {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.view-menu a {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 7px 14px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface);
    color: #4d627f;
    font-size: 13px;
    font-weight: 700;
}

.view-menu a.active {
    border-color: var(--blue-700);
    background: var(--blue-100);
    color: var(--blue-700);
}

.notice,
.message {
    padding: 10px 12px;
    border-radius: 6px;
    color: var(--navy-800);
    background: var(--blue-100);
}

.table-wrap {
    overflow-x: auto;
    margin-bottom: 12px;
}

.data-grid {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.data-grid th,
.data-grid td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--line-soft);
    text-align: left;
    white-space: nowrap;
}

.data-grid th {
    background: #f7f9fc;
    color: var(--navy-800);
}

.data-grid tbody tr:hover td {
    background: var(--blue-050);
}

.data-grid .empty {
    padding: 18px;
    color: var(--muted);
    text-align: center;
}

.update-time-grid .is-empty td {
    color: var(--muted);
}

.update-time-panel {
    padding: 0;
    overflow: hidden;
    border-radius: 4px;
    box-shadow: none;
}

.update-time-workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: start;
    gap: 12px;
}

.update-time-workspace > .panel {
    min-width: 0;
    margin-bottom: 0;
}

.update-time-panel > h2 {
    margin: 0;
    padding: 12px 14px;
    background: #f7f9fc;
    border-bottom: 1px solid #b8c5d6;
    font-size: 15px;
}

.update-time-panel .table-wrap {
    max-height: calc(100vh - 255px);
    margin: 0;
    overflow: auto;
}

.update-time-grid {
    width: max-content;
    min-width: 0;
    table-layout: auto;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 12px;
}

.update-time-grid th,
.update-time-grid td {
    height: 29px;
    padding: 4px 8px;
    background: var(--surface);
    border-right: 1px solid #c7d1df;
    border-bottom: 1px solid #c7d1df;
    line-height: 20px;
}

.update-time-grid th {
    position: sticky;
    z-index: 1;
    top: 0;
    background: #e9eef6;
    color: var(--navy-800);
    font-weight: 700;
}

.update-time-grid th:last-child,
.update-time-grid td:last-child {
    border-right: 1px solid #c7d1df;
}

.update-time-grid tbody tr:hover td {
    background: #eaf2ff;
}

.update-time-grid td:first-child {
    color: var(--navy-800);
    font-weight: 600;
}

.update-time-grid td:nth-child(3) {
    font-variant-numeric: tabular-nums;
}

.data-preview-button {
    min-height: 24px;
    padding: 2px 7px;
    border-radius: 2px;
    font-size: 10px;
    white-space: nowrap;
}

.update-time-grid tr.is-preview-active td {
    background: #dceafe;
}

.table-preview-panel {
    padding: 0;
    overflow: hidden;
    border-radius: 4px;
    box-shadow: none;
}

.table-preview-header {
    display: flex;
    min-height: 41px;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 10px;
    background: #f7f9fc;
    border-bottom: 1px solid #b8c5d6;
}

.table-preview-header h2 {
    min-width: 0;
    margin: 0;
    overflow: hidden;
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.table-preview-header span {
    flex: 0 0 auto;
    color: var(--muted);
    font-size: 10px;
    white-space: nowrap;
}

.table-preview-body {
    height: calc(100vh - 255px);
    min-height: 360px;
    overflow: hidden;
    background: var(--surface);
}

.table-preview-empty {
    margin: 0;
    padding: 20px;
    color: var(--muted);
    font-size: 12px;
    text-align: center;
}

.table-preview-empty.is-error {
    color: var(--danger);
}

.table-preview-scroll {
    width: 100%;
    height: 100%;
    overflow: auto;
}

.preview-data-grid {
    width: max-content;
    min-width: 100%;
    table-layout: auto;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 10px;
}

.preview-data-grid th,
.preview-data-grid td {
    height: 25px;
    max-width: 320px;
    padding: 3px 6px;
    overflow: hidden;
    background: var(--surface);
    border-right: 1px solid #c7d1df;
    border-bottom: 1px solid #c7d1df;
    line-height: 18px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.preview-data-grid th {
    position: sticky;
    z-index: 1;
    top: 0;
    color: var(--navy-800);
    background: #e9eef6;
    font-weight: 700;
}

.preview-data-grid tbody tr:hover td {
    background: #eaf2ff;
}

@media (max-width: 1050px) {
    .update-time-workspace {
        grid-template-columns: 1fr;
    }

    .table-preview-body {
        height: 480px;
        min-height: 0;
    }
}

.update-time-sort {
    all: unset;
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
}

.update-time-sort:focus-visible {
    color: var(--blue-700);
    outline: 2px solid #7e9dca;
    outline-offset: 2px;
}

.update-time-grid .update-time-sort:hover {
    color: var(--blue-700);
    background: transparent;
}

.sort-indicator {
    width: 10px;
    color: var(--blue-700);
    text-align: center;
}

.sort-indicator::before {
    content: "↕";
    color: #8494a8;
    font-size: 10px;
}

th[aria-sort="ascending"] .sort-indicator::before {
    content: "▲";
    color: var(--blue-700);
    font-size: 8px;
}

th[aria-sort="descending"] .sort-indicator::before {
    content: "▼";
    color: var(--blue-700);
    font-size: 8px;
}

.action-table-wrap {
    margin: 0;
    overflow: auto;
}

.action-grid {
    min-width: 1380px;
    table-layout: fixed;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 12px;
}

.action-grid .action-col-name {
    width: 180px;
}

.action-grid .action-col-description {
    width: auto;
}

.action-grid .action-col-status {
    width: 260px;
}

.action-grid .action-col-target {
    width: 210px;
}

.action-grid .action-col-settings {
    width: 145px;
}

.action-grid .action-col-operation {
    width: 145px;
}

.action-grid th,
.action-grid td {
    padding: 6px 8px;
    vertical-align: top;
    white-space: normal;
    background: var(--surface);
    border-right: 1px solid #c7d1df;
    border-bottom: 1px solid #c7d1df;
    line-height: 1.45;
}

.action-grid th {
    padding-top: 5px;
    padding-bottom: 5px;
    color: var(--navy-800);
    background: #f7f9fc;
    font-size: 11px;
    font-weight: 700;
}

.action-grid th:last-child,
.action-grid td:last-child {
    border-right: 0;
}

.action-grid tbody tr:last-child td {
    border-bottom: 0;
}

.action-grid tbody tr:hover td {
    background: #eaf2ff;
}

.action-name-cell strong {
    display: block;
    color: var(--navy-950);
    font-size: 13px;
}

.action-description-cell {
    color: #435a78;
}

.action-grid .update-status {
    margin: 0;
    padding: 5px 7px;
    border-radius: 2px;
    font-size: 11px;
    line-height: 1.45;
}

.action-grid .update-status-title {
    margin-bottom: 2px;
    font-size: 12px;
}

.action-cron-label {
    display: inline-block;
    margin-top: 4px;
    padding: 1px 5px;
    color: #b42318;
    background: #fff5f5;
    border: 1px solid #efb4b4;
    border-radius: 2px;
    font-size: 10px;
    font-weight: 700;
}

.action-cron-detail {
    display: block;
    margin-top: 4px;
    color: #b42318;
}

.cell-empty {
    color: #94a3b8;
}

.action-target-cell label {
    margin: 0;
    color: #52657f;
    font-size: 10px;
}

.action-target-cell label + label {
    display: block;
    margin-top: 5px;
}

.action-target-cell input[type="text"] {
    height: 28px;
    margin-top: 2px;
    padding: 3px 6px;
    border-radius: 2px;
    font-size: 12px;
}

.action-settings-cell .check {
    margin: 0 0 5px;
    gap: 5px;
    color: #344764;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
}

.action-settings-cell .check:last-child {
    margin-bottom: 0;
}

.action-operation-cell form {
    display: flex;
    align-items: center;
    gap: 5px;
}

.action-operation-cell button,
.action-operation-cell .secondary-button {
    min-height: 29px;
    padding: 4px 9px;
    border-radius: 3px;
    font-size: 11px;
    white-space: nowrap;
}

pre {
    overflow: auto;
    max-height: 520px;
    margin: 0;
    padding: 12px;
    border-radius: 6px;
    background: #111827;
    color: #e5e7eb;
    font-size: 12px;
    line-height: 1.5;
}

@media (max-width: 720px) {
    .cron-status-body {
        grid-template-columns: 1fr;
    }
}
