/* Shared admin presentation. Tabler supplies controls and layout primitives. */
:root {
  --app-ink: #101f3b;
  --app-muted: #62738f;
  --app-line: #dbe5f2;
  --app-surface: #ffffff;
  --app-canvas: #f3f7fd;
  --app-accent: #1264d6;
  --app-radius: 14px;
}
[hidden] { display: none !important; }
body { color: var(--app-ink); background: var(--app-canvas); font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif; }
button, input, select { font-family: inherit; }
.icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.brand-mark { display: inline-grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: 12px; background: #1469dc; box-shadow: 0 7px 16px rgba(4, 56, 127, .28); color: #fff; font-size: 21px; font-weight: 700; line-height: 1; }

.app-sidebar { border-right: 1px solid #0a1f40; background: #0b1d3b; color: #e5edfb; }
.app-sidebar .navbar-brand { display: flex; align-items: center; gap: 12px; margin: 0; padding: 26px 14px 25px; color: #fff; font-size: 17px; font-weight: 720; letter-spacing: .01em; }
@media (min-width: 992px) { .navbar.navbar-vertical.app-sidebar .navbar-brand { justify-content: flex-start; padding: 26px 16px 24px; } }
.brand-copy { display: flex; flex-direction: column; line-height: 1.18; }
.brand-copy small { margin-top: 5px; color: #94a9cb; font-size: 11px; font-weight: 500; letter-spacing: .04em; }
.navbar.navbar-vertical.app-sidebar .nav-section-title { color: #9aacc9; font-size: 11px; font-weight: 700; letter-spacing: .12em; padding: 4px 12px; margin-bottom: 8px; }
.app-sidebar .nav-link { margin: 3px 8px; padding: 11px 14px; border-radius: 10px; color: #c9d6e9; font-size: 13px; font-weight: 600; transition: background-color .18s, color .18s; }
.app-sidebar .nav-link:hover { background: #173357; color: #fff; }
.app-sidebar .nav-link.active { background: #1468d7; color: #fff; box-shadow: 0 6px 14px rgba(1, 20, 49, .24); }
.app-sidebar .nav-link-icon, .app-sidebar .nav-link.active .nav-link-icon { color: inherit; }
.app-topbar { height: 68px; background: var(--app-surface); border-bottom: 1px solid var(--app-line); }
.topbar-context { display: flex; align-items: baseline; gap: 12px; }
.topbar-label { color: var(--app-muted); font-size: 12px; }
.topbar-label::after { content: "›"; margin-left: 12px; color: #9eb0c8; font-size: 18px; line-height: 0; }
.topbar-context strong { font-size: 14px; }
.topbar-service { display: inline-flex; align-items: center; gap: 8px; color: var(--app-muted); font-size: 12px; white-space: nowrap; }
.topbar-service .status-dot { width: 7px; height: 7px; }

.app-content { max-width: 1540px; padding-top: 35px; padding-bottom: 52px; }
.page-body .page-header.app-page-header { display: flex; flex-direction: row; justify-content: space-between; align-items: flex-end; gap: 18px; margin: 0 0 26px; }
.app-page-header .page-title { margin: 0; color: var(--app-ink); font-size: 29px; font-weight: 740; line-height: 1.2; letter-spacing: -.02em; }
.page-subtitle { margin: 9px 0 0; color: var(--app-muted); font-size: 13px; }
.page-actions { display: flex; gap: 8px; }
.page-actions .form-select { min-width: 158px; }
.card { border-color: var(--app-line); border-radius: var(--app-radius); box-shadow: 0 8px 28px rgba(22, 52, 99, .055); overflow: hidden; }
.card-header { min-height: 65px; padding: 14px 20px; gap: 11px; }
.card-title { color: var(--app-ink); font-size: 15px; font-weight: 700; }
.card-count { padding: 5px 10px; border-radius: 7px; background: #f0f5fb; color: #526b8e; font-size: 11px; font-weight: 600; white-space: nowrap; }
.section-icon { display: inline-grid; place-items: center; width: 31px; height: 31px; flex: none; border-radius: 8px; background: #eaf2ff; color: var(--app-accent); }
.section-icon .icon { width: 17px; height: 17px; }
.metric-card .card-body { padding: 20px 22px 21px; }
.metric-card { min-height: 155px; }
.metric-heading { display: flex; align-items: center; gap: 11px; }
.metric-icon { display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 11px; background: #eaf2ff; color: var(--app-accent); }
.metric-icon .icon { width: 22px; height: 22px; }
.metric-label { color: #3f5777; font-size: 13px; font-weight: 650; }
.metric-value { margin: 11px 0 0 53px; color: var(--app-ink); font-size: clamp(29px, 2.6vw, 38px); line-height: 1.1; font-weight: 760; letter-spacing: -.035em; }
.metric-foot { margin: 9px 0 0 53px; color: #778aa6; font-size: 11px; }
.info-row { display: flex; align-items: baseline; justify-content: space-between; gap: 20px; padding: 14px 0; border-bottom: 1px solid var(--app-line); font-size: 12px; }
.info-row:first-child { padding-top: 2px; }
.info-row > span { color: var(--app-muted); white-space: nowrap; }
.info-row strong, .info-row code { min-width: 0; font-size: 12px; font-weight: 600; text-align: right; overflow-wrap: anywhere; word-break: break-all; }
.context-note { margin-top: 16px; color: var(--app-muted); font-size: 12px; line-height: 1.7; }
.context-note code { color: #375b8c; font-size: 12px; }

.app-table-wrap { width: 100%; overflow-x: auto; }
.table-scroll-hint { display: none; }
.app-table { width: 100%; margin-bottom: 0; font-size: 12px; }
.app-table thead th { padding: 12px 18px; background: #f5f8fc; color: #627693; font-size: 11px; font-weight: 700; text-transform: none; white-space: nowrap; border-bottom: 1px solid var(--app-line); }
.app-table tbody td { padding: 14px 18px; color: #31435e; vertical-align: middle; border-color: #e9eff6; }
.app-table tbody tr:last-child td { border-bottom: 0; }
.app-table tbody tr:hover td { background: #f5f9ff; }
.app-table .cell-primary { color: var(--app-ink); font-weight: 600; }
.app-table .cell-sub { display: block; margin-top: 3px; color: #8799b1; font-size: 11px; font-weight: 400; }
.app-table .mono { font-family: ui-monospace, Consolas, monospace; font-variant-numeric: tabular-nums; }
.app-table .table-actions { white-space: nowrap; text-align: right; }
.app-table .table-actions .btn { margin-left: 4px; }
.table-empty { padding: 62px 16px; text-align: center; color: var(--app-muted); font-size: 13px; }
.table-empty strong { display: block; margin-bottom: 4px; color: var(--app-ink); font-size: 14px; }
.table-footer { display: flex; align-items: center; justify-content: space-between; gap: 18px; min-height: 68px; padding: 13px 18px; border-top: 1px solid var(--app-line); background: #fff; color: var(--app-muted); font-size: 12px; }
.table-range { white-space: nowrap; }
.table-range strong { color: #3a506f; font-weight: 650; }
.table-footer-controls, .table-size-label, .table-pages { display: inline-flex; align-items: center; gap: 8px; }
.table-size-label { white-space: nowrap; }
.table-size-label .form-select { width: 68px; min-width: 68px; padding-right: 21px; background-position: right .4rem center; font-size: 12px; }
.table-pages { gap: 4px; }
.page-number { display: inline-grid; place-items: center; min-width: 31px; height: 31px; padding: 0 5px; border: 1px solid transparent; border-radius: 7px; background: transparent; color: #405574; font-size: 12px; font-weight: 600; }
.page-number:hover:not(:disabled) { border-color: #c8d9ee; background: #eef5ff; color: #095ec5; }
.page-number.active, .page-number.active:hover:not(:disabled) { border-color: var(--app-accent); background: var(--app-accent); color: #fff; box-shadow: 0 3px 8px rgba(18, 100, 214, .2); }
.page-number:disabled { opacity: .38; cursor: not-allowed; }
.page-arrow { border-color: var(--app-line); }
.page-arrow svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.page-arrow.next svg { transform: rotate(180deg); }
.page-gap { padding: 0 3px; color: #8799b1; }
.status-badge { display: inline-flex; align-items: center; gap: 6px; padding: 5px 9px; border-radius: 999px; font-size: 11px; font-weight: 650; white-space: nowrap; line-height: 1; }
.status-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-badge.good { background: #e7f7ee; color: #138453; }
.status-badge.neutral { background: #f0f3f7; color: #65768d; }
.status-badge.warn { background: #fff4df; color: #a96b08; }
.status-badge.bad { background: #fdebed; color: #bf3745; }
.status-badge.info { background: #eaf2ff; color: #1767c8; }
.job-card .card-body { padding: 18px 20px; }
.job-card .job-name { font-weight: 650; font-size: 13px; }
.job-card .job-time { margin-top: 8px; color: var(--app-muted); font-size: 11px; }
.job-card .job-next { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--app-line); color: var(--app-muted); font-size: 11px; }

#app-modal .app-modal-dialog { width: calc(100% - 32px); max-width: 540px; }
#app-modal .app-modal-dialog.wide { max-width: 760px; }
#app-modal .modal-content { border: 1px solid #d8e3f1; border-radius: 18px; box-shadow: 0 28px 80px rgba(8, 27, 57, .22); overflow: hidden; }
#app-modal .modal-header { display: flex; align-items: flex-start; gap: 14px; padding: 23px 26px 20px; border-bottom: 1px solid var(--app-line); background: #f9fbff; }
#app-modal .modal-header .btn-close { margin: 3px 0 0 auto; flex: none; }
#app-modal .modal-icon { display: inline-grid; place-items: center; width: 43px; height: 43px; flex: none; border-radius: 12px; background: #e7f0ff; color: var(--app-accent); }
#app-modal .modal-icon.danger { background: #feebed; color: #bf3745; }
#app-modal .modal-heading { min-width: 0; flex: 1; }
#app-modal .modal-title { margin: 1px 0 0; color: var(--app-ink); font-size: 18px; font-weight: 740; line-height: 1.35; }
#app-modal .modal-description { margin: 5px 0 0; color: var(--app-muted); font-size: 12px; line-height: 1.55; overflow-wrap: anywhere; }
#app-modal .modal-body { max-height: min(65dvh, 620px); padding: 24px 26px 26px; overflow-y: auto; color: #31435e; font-size: 13px; }
#app-modal .modal-footer { display: flex; justify-content: flex-end; gap: 10px; padding: 17px 26px; border-top: 1px solid var(--app-line); background: #f9fbff; }
#app-modal .modal-footer .btn { min-width: 90px; border-radius: 8px; font-weight: 600; }
#app-modal .modal-form-status, .auth-error { margin-bottom: 18px; padding: 11px 13px; border: 1px solid #f2c9ce; border-radius: 9px; background: #fff3f4; color: #a92e3b; font-size: 12px; line-height: 1.5; }
#app-modal .form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-field { margin-bottom: 18px; }
.form-field:last-child { margin-bottom: 0; }
.form-field .form-label { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 7px; color: #243a59; font-size: 12px; font-weight: 680; }
.field-meta { color: #8a9ab0; font-size: 10px; font-weight: 500; }
.field-meta.required { color: #b4414d; }
.form-field .form-control { min-height: 43px; border-color: #d4deeb; border-radius: 8px; background-color: #fff; color: var(--app-ink); font-size: 13px; transition: border-color .16s, box-shadow .16s; }
.form-field .form-control:focus { border-color: #4388e7; box-shadow: 0 0 0 3px rgba(18, 100, 214, .12); }
.form-field .form-control.is-invalid { border-color: #dc6671; background-image: none; box-shadow: 0 0 0 3px rgba(220, 102, 113, .1); }
.form-field .form-control.is-invalid:focus { border-color: #d44756; box-shadow: 0 0 0 3px rgba(220, 102, 113, .15); }
.form-field .form-hint { margin-top: 7px; color: #778aa4; font-size: 11px; line-height: 1.5; }
.field-error { margin-top: 6px; color: #bd3947; font-size: 11px; font-weight: 600; line-height: 1.45; }
#app-modal .secret-panel { padding: 18px; border: 1px solid #dce6f3; border-radius: 11px; background: #f7faff; }
#app-modal .secret-panel .form-field:last-child { margin-bottom: 0; }
#app-modal .secret-input { background: #fff; }
#app-modal .action-list { border-radius: 10px; overflow: hidden; }
#app-modal .action-list .list-group-item { padding: 13px 15px; font-size: 13px; font-weight: 580; }
#app-modal .action-list .list-group-item:hover { background: #f3f7fd; }
#app-modal .modal-confirm-message { margin: 0; padding: 15px 17px; border: 1px solid #dce6f3; border-radius: 10px; background: #f7faff; line-height: 1.65; }
#app-modal .modal-confirm-message.danger { border-color: #f0d5d9; background: #fff6f6; }
.detail-block { margin: 0 0 16px; }
.detail-block:last-child { margin-bottom: 0; }
.detail-block .detail-label { margin-bottom: 7px; color: var(--app-muted); font-size: 11px; font-weight: 700; }
.detail-content { max-height: 340px; margin: 0; padding: 14px; overflow: auto; border: 1px solid var(--app-line); border-radius: 7px; background: #f8fafc; color: #26374d; white-space: pre-wrap; overflow-wrap: anywhere; font: 12px/1.65 ui-monospace, Consolas, monospace; }
.secret-input { font-family: ui-monospace, Consolas, monospace; }
.toast-area { position: fixed; top: 20px; right: 20px; z-index: 1100; width: min(360px, calc(100vw - 32px)); }
.toast-area .alert { box-shadow: 0 8px 32px rgba(23, 36, 59, .12); }

.auth-page { display: grid; grid-template-columns: minmax(360px, 42%) 1fr; min-height: 100vh; background: #fff; }
.auth-brand { display: flex; flex-direction: column; justify-content: space-between; padding: clamp(32px, 6vw, 80px); background: #0b1d3b; color: #fff; }
.auth-brand .brand-mark { background: #327fe0; width: 50px; height: 50px; font-size: 27px; }
.auth-brand-inner { margin-top: 14vh; }
.auth-brand-title { margin-top: 26px; font-size: clamp(29px, 3vw, 42px); font-weight: 700; letter-spacing: -.02em; }
.auth-brand p { max-width: 330px; margin: 14px 0 0; color: #aac1df; font-size: 14px; line-height: 1.8; }
.auth-form-side { display: grid; place-items: center; padding: 32px; }
.auth-form-wrap { width: min(100%, 360px); }
.auth-form-wrap h1 { margin: 0; font-size: 27px; font-weight: 700; }
.auth-form-wrap form { margin-top: 24px; }
.auth-form-wrap .form-control { height: 43px; }
.auth-form-wrap .btn { height: 43px; margin-top: 8px; }
.auth-form-wrap .auth-error { margin-top: 4px; }
.auth-mobile-brand { display: none; align-items: center; gap: 9px; margin-bottom: 36px; }

@media (max-width: 991.98px) {
  .app-sidebar .navbar-brand { padding: 12px 6px; }
  .app-sidebar .nav-link { margin: 2px 0; }
  .app-content { padding-top: 22px; }
}
@media (max-width: 767.98px) {
  .auth-page { display: block; }
  .auth-brand { display: none; }
  .auth-form-side { min-height: 100vh; padding: 28px; }
  .auth-mobile-brand { display: flex; }
  .topbar-label, .topbar-service { display: none; }
  .app-topbar { height: 52px; }
  .page-body .page-header.app-page-header { align-items: flex-start; }
  .app-page-header .page-title { font-size: 22px; }
  .page-actions { width: 100%; }
  .page-actions .form-select { min-width: 0; flex: 1; }
  .table-footer { flex-wrap: wrap; }
  .table-footer-controls { width: 100%; justify-content: space-between; }
}
@media (max-width: 575.98px) {
  .page-body .page-header.app-page-header { flex-direction: column; }
  .app-page-header > .btn { align-self: flex-start; }
  .metric-card .card-body { padding: 18px 20px; }
  .metric-value, .metric-foot { margin-left: 0; }
  .app-table { min-width: 640px; }
  .table-scroll-hint { display: block; padding: 8px 14px; border-bottom: 1px solid var(--app-line); color: #6b7e9c; font-size: 11px; text-align: right; }
  .table-scroll-hint svg { width: 13px; height: 13px; margin-left: 3px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -2px; }
  .app-table .table-actions { position: sticky; right: 0; background: #fff; box-shadow: -5px 0 10px rgba(23, 36, 59, .045); }
  .app-table tr:hover .table-actions { background: #f5f9ff; }
  .table-footer { padding: 13px 14px; }
  .table-footer-controls { flex-wrap: wrap; gap: 12px; }
  #app-modal .app-modal-dialog { width: calc(100% - 20px); margin: 10px; }
  #app-modal .modal-header { padding: 18px 18px 16px; }
  #app-modal .modal-body { max-height: 65dvh; padding: 20px 18px; }
  #app-modal .modal-footer { padding: 14px 18px; }
  #app-modal .form-grid { grid-template-columns: 1fr; gap: 0; }
}
