:root {
    --bg: #0f172a;
    --bg-soft: #111827;
    --panel: #111827;
    --panel-soft: #1f2937;
    --panel-hover: #273244;

    --text: #e5e7eb;
    --text-strong: #f9fafb;
    --muted: #9ca3af;
    --muted-soft: #6b7280;

    --line: #374151;
    --line-soft: rgba(255, 255, 255, 0.08);

    --accent: #38bdf8;
    --accent-dark: #0284c7;
    --accent-soft: rgba(56, 189, 248, 0.14);

    --success: #34d399;
    --warning: #fbbf24;
    --danger: #fb7185;

    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 18px;
    --radius-xl: 24px;

    --shadow-panel: 0 20px 70px rgba(0, 0, 0, 0.28);
    --shadow-soft: 0 10px 30px rgba(0, 0, 0, 0.18);

    --container: 1180px;
}

* { box-sizing: border-box; }

html { min-height: 100%; }

body {
    margin: 0;
    min-height: 100vh;
    font-family: Arial, Helvetica, sans-serif;
    background:
        radial-gradient(circle at top left, rgba(56, 189, 248, 0.09), transparent 34%),
        radial-gradient(circle at top right, rgba(129, 140, 248, 0.08), transparent 30%),
        var(--bg);
    color: var(--text);
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
textarea,
select {
    font: inherit;
}

code {
    display: inline-block;
    max-width: 100%;
    padding: 3px 7px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #020617;
    color: var(--accent);
    font-size: 13px;
    overflow-wrap: anywhere;
}

/* =========================
   App shell
   (unchanged markup; updated to work with baseUrl assets)
========================= */

.app-shell {
    width: min(var(--container), calc(100% - 32px));
    margin: 0 auto;
    padding: 24px 0;
}

.app-main {
    min-height: 520px;
}

/* =========================
   Header
========================= */

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 20px;
}

.app-header__brand { min-width: 0; }

.app-logo {
    display: inline-flex;
    align-items: center;
    gap: 14px;
}

.app-logo__mark {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border-radius: 15px;
    background: linear-gradient(135deg, #38bdf8, #818cf8);
    color: #020617;
    font-size: 22px;
    font-weight: 900;
    letter-spacing: -0.06em;
    box-shadow: 0 12px 30px rgba(56, 189, 248, 0.22);
}

.app-logo__text {
    display: grid;
    gap: 3px;
}

.app-logo__text strong {
    color: var(--text-strong);
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.04em;
}

.app-logo__text small {
    color: var(--muted);
    font-size: 13px;
}

.app-header__meta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.system-status,
.app-header__mode {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(17, 24, 39, 0.72);
    color: var(--muted);
    font-size: 13px;
}

.system-status::before {
    content: "";
    width: 8px;
    height: 8px;
    margin-right: 8px;
    border-radius: 999px;
    background: var(--muted-soft);
}

.system-status--online::before {
    background: var(--success);
    box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.12);
}

/* =========================
   Tabs
   (class is-active is now injected without escaping; unchanged selector)
========================= */

.app-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px;
    margin-bottom: 20px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: rgba(17, 24, 39, 0.72);
    box-shadow: var(--shadow-soft);
}

.app-tabs__item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 9px 14px;
    border-radius: 12px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 600;
    transition:
        color 0.16s ease,
        background 0.16s ease,
        transform 0.16s ease;
}

.app-tabs__item:hover {
    color: var(--text-strong);
    background: var(--panel-hover);
}

.app-tabs__item.is-active {
    color: #082f49;
    background: var(--accent);
    font-weight: 800;
    box-shadow: 0 10px 24px rgba(56, 189, 248, 0.2);
}

/* Optional: keyboard focus visibility */
.app-tabs__item:focus-visible,
.app-logo:focus-visible,
.button:focus-visible {
    outline: none;
    box-shadow: 0 0 0 4px var(--accent-soft);
}

/* =========================
   Module base
========================= */

.module {
    padding: 26px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: rgba(17, 24, 39, 0.88);
    box-shadow: var(--shadow-panel);
}

.module__header { margin-bottom: 22px; }

.module__header h1 {
    margin: 0 0 8px;
    color: var(--text-strong);
    font-size: 30px;
    line-height: 1.12;
    font-weight: 850;
    letter-spacing: -0.05em;
}

.module__header p {
    max-width: 760px;
    margin: 0;
    color: var(--muted);
    font-size: 15px;
    line-height: 1.6;
}

.module--error {
    border-color: rgba(251, 113, 133, 0.5);
}

.module--placeholder { border-style: dashed; }

/* =========================
   Notices / buttons
========================= */

.notice {
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: rgba(31, 41, 55, 0.68);
    color: var(--muted);
    line-height: 1.55;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 10px 16px;
    border: 0;
    border-radius: var(--radius-md);
    background: var(--accent);
    color: #082f49;
    font-weight: 800;
    cursor: pointer;
    transition:
        background 0.16s ease,
        transform 0.16s ease,
        box-shadow 0.16s ease;
}

.button:hover {
    background: #7dd3fc;
    box-shadow: 0 12px 28px rgba(56, 189, 248, 0.22);
}

.button:active { transform: translateY(1px); }

/* =========================
   Dashboard cards
========================= */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.stat-card {
    min-height: 130px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.025), transparent),
        var(--panel-soft);
}

.stat-card__label {
    display: block;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.stat-card__value {
    display: block;
    margin-top: 14px;
    color: var(--text-strong);
    font-size: 38px;
    line-height: 1;
    font-weight: 900;
    letter-spacing: -0.07em;
}

/* =========================
   Generic cards / grids
========================= */

.card-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.card {
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--panel-soft);
}

.card h2,
.card h3 {
    margin: 0 0 8px;
    color: var(--text-strong);
    letter-spacing: -0.03em;
}

.card p {
    margin: 0;
    color: var(--muted);
    line-height: 1.55;
}

/* =========================
   Tables
========================= */

.table-wrap {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 720px;
}

.data-table th,
.data-table td {
    padding: 14px;
    border-bottom: 1px solid var(--line-soft);
    text-align: left;
    vertical-align: top;
}

.data-table th {
    background: rgba(31, 41, 55, 0.82);
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.data-table td {
    color: var(--text);
    font-size: 14px;
}

.data-table tr:last-child td { border-bottom: 0; }

.data-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.025);
}

/* =========================
   Forms
========================= */

.form {
    display: grid;
    gap: 16px;
    max-width: 760px;
}

.form-row {
    display: grid;
    gap: 8px;
}

.form-row label {
    color: var(--text-strong);
    font-size: 14px;
    font-weight: 800;
}

.form-row small {
    color: var(--muted-soft);
    line-height: 1.45;
}

input,
textarea,
select {
    width: 100%;
    padding: 12px 13px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: #020617;
    color: var(--text);
    outline: none;
    transition:
        border-color 0.16s ease,
        box-shadow 0.16s ease;
}

textarea {
    min-height: 140px;
    resize: vertical;
    line-height: 1.5;
}

input::placeholder,
textarea::placeholder {
    color: #64748b;
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-soft);
}

/* =========================
   Badges
========================= */

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 4px 9px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.12);
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.badge--success {
    background: rgba(52, 211, 153, 0.12);
    color: var(--success);
}

.badge--warning {
    background: rgba(251, 191, 36, 0.12);
    color: var(--warning);
}

.badge--danger {
    background: rgba(251, 113, 133, 0.12);
    color: var(--danger);
}

.badge--accent {
    background: var(--accent-soft);
    color: var(--accent);
}

/* =========================
   Empty state
========================= */

.empty-state {
    display: grid;
    gap: 8px;
    padding: 22px;
    border: 1px dashed var(--line);
    border-radius: var(--radius-md);
    background: rgba(31, 41, 55, 0.48);
    color: var(--muted);
}

.empty-state strong { color: var(--text-strong); }

/* =========================
   Footer
========================= */

.app-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 20px;
    padding: 14px 4px 4px;
    color: var(--muted-soft);
    font-size: 13px;
}

/* =========================
   Responsive
========================= */

@media (max-width: 920px) {
    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .card-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    .app-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .app-header__meta {
        justify-content: flex-start;
    }

    .app-tabs__item {
        flex: 1 1 auto;
    }

    .module {
        padding: 20px;
    }

    .module__header h1 {
        font-size: 26px;
    }

    .app-footer {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media (max-width: 560px) {
    .app-shell {
        width: min(var(--container), calc(100% - 20px));
        padding: 14px 0;
    }

    .app-logo__mark {
        width: 42px;
        height: 42px;
    }

    .app-logo__text strong {
        font-size: 18px;
    }

    .app-tabs {
        gap: 6px;
        padding: 8px;
    }

    .app-tabs__item {
        min-height: 38px;
        padding: 8px 10px;
        font-size: 13px;
    }

    .stats-grid,
    .card-grid {
        grid-template-columns: 1fr;
    }

    .stat-card {
        min-height: 112px;
    }

    .stat-card__value {
        font-size: 34px;
    }
} 






/* =========================
   Dashboard (module-specific)
========================= */

/* spacing helpers inside dashboard without inline <div style="height:..."> */
.dashboard-gap-sm { height: 12px; }
.dashboard-gap-md { height: 16px; }
.dashboard-gap-lg { height: 18px; }

/* Stat values that are not big numbers (ENV / OK / etc.) */
.stat-card__value--meta {
    font-size: 28px;
    letter-spacing: -0.04em;
    font-weight: 900;
}

/* Make stat cards feel more interactive/clean */
.stat-card {
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(circle at 20% 0%, rgba(56, 189, 248, 0.12), transparent 45%);
    opacity: 0.55;
}

/* Quick actions row */
.dashboard-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Make action buttons visually smaller inside cards */
.dashboard-actions .button {
    min-height: 40px;
    padding: 9px 14px;
}

/* Logs table message column: mono + nicer wrapping */
.dashboard-log {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 13px;
    line-height: 1.45;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    color: rgba(229, 231, 235, 0.92);
}

/* Slightly tighter table for logs */
.dashboard-log-table .data-table th,
.dashboard-log-table .data-table td {
    padding: 12px 14px;
}

/* Emphasize time column */
.dashboard-log-table .data-table td:first-child {
    color: var(--muted);
    font-weight: 700;
    white-space: nowrap;
}

/* Card headings inside dashboard */
.card h3 {
    font-size: 16px;
    font-weight: 850;
}

/* Small badges row spacing */
.card .badge {
    margin-right: 6px;
}

/* Responsive tweaks for dashboard */
@media (max-width: 920px) {
    .dashboard-actions .button {
        flex: 1 1 auto;
    }
} 






/* =========================
   Sites module
========================= */

.module--sites .notice {
    margin-top: 16px;
}

/* Notice variants + list */
.notice--danger {
    border-color: rgba(251, 113, 133, 0.45);
    background: rgba(251, 113, 133, 0.08);
    color: rgba(229, 231, 235, 0.92);
}

.notice--success {
    border-color: rgba(52, 211, 153, 0.45);
    background: rgba(52, 211, 153, 0.08);
    color: rgba(229, 231, 235, 0.92);
}

.notice strong {
    color: var(--text-strong);
    font-weight: 850;
}

.notice__list {
    margin: 10px 0 0;
    padding-left: 18px;
    color: var(--muted);
    line-height: 1.6;
}

.notice__list li {
    margin: 4px 0;
}

/* Two-card layout: form + info */
.sites-layout {
    margin-top: 16px;
    align-items: start;
}

.sites-form-card h2,
.sites-info-card h2 {
    margin: 0 0 8px;
    color: var(--text-strong);
    letter-spacing: -0.03em;
    font-size: 18px;
    font-weight: 900;
}

.sites-form-card > p,
.sites-info-card > p {
    margin: 0 0 14px;
    color: var(--muted);
    line-height: 1.55;
}

/* Info list inside the info card */
.info-list {
    display: grid;
    gap: 10px;
    margin-top: 14px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: rgba(2, 6, 23, 0.35);
}

.info-list > div {
    display: grid;
    gap: 2px;
    padding: 10px 12px;
    border: 1px solid var(--line-soft);
    border-radius: 12px;
    background: rgba(31, 41, 55, 0.55);
}

.info-list strong {
    color: var(--text-strong);
    font-weight: 900;
    letter-spacing: -0.02em;
}

.info-list span {
    color: var(--muted);
    line-height: 1.45;
}

/* Section below cards (table section) */
.module-section {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid var(--line-soft);
}

.module-section__header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 12px;
}

.module-section__header h2 {
    margin: 0 0 6px;
    color: var(--text-strong);
    font-size: 18px;
    font-weight: 900;
    letter-spacing: -0.03em;
}

.module-section__header p {
    margin: 0;
    color: var(--muted);
    line-height: 1.55;
}

/* Button inside sites form a bit tighter */
.module--sites .form .button {
    min-height: 40px;
    padding: 9px 14px;
}

/* Links inside table */
.data-table a {
    color: var(--text-strong);
    font-weight: 750;
    text-decoration: underline;
    text-decoration-color: rgba(56, 189, 248, 0.35);
    text-underline-offset: 3px;
}

.data-table a:hover {
    text-decoration-color: rgba(56, 189, 248, 0.75);
}

/* Code blocks inside table cells */
.data-table td code {
    background: rgba(2, 6, 23, 0.65);
    border-color: rgba(56, 189, 248, 0.25);
    color: rgba(125, 211, 252, 0.95);
}

/* Table sizing tweaks for this module */
.module--sites .data-table {
    min-width: 860px;
}

.module--sites .data-table th {
    white-space: nowrap;
}

.module--sites .data-table td {
    line-height: 1.45;
}

/* Responsive */
@media (max-width: 920px) {
    .sites-layout {
        grid-template-columns: 1fr;
    }

    .module-section__header {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media (max-width: 720px) {
    .module--sites .data-table {
        min-width: 720px;
    }
} 





/* =========================
   Logs module
========================= */

.logs-layout { margin-top: 16px; align-items: start; }

.logs-date-range {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.logs-button {
    min-height: 40px;
    padding: 9px 14px;
}

.logs-button--danger {
    background: rgba(251, 113, 133, 0.85);
    color: #020617;
}

.logs-button--danger:hover {
    background: rgba(251, 113, 133, 1);
    box-shadow: 0 12px 28px rgba(251, 113, 133, 0.18);
}

.logs-table { min-width: 980px; }

.logs-message {
    font-size: 14px;
    line-height: 1.5;
    color: rgba(229, 231, 235, 0.95);
}

.logs-details {
    margin-top: 8px;
}

.logs-details summary {
    cursor: pointer;
    color: var(--muted);
    font-weight: 700;
    font-size: 12px;
}

.logs-pre {
    margin: 10px 0 0;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: rgba(2, 6, 23, 0.55);
    color: rgba(229, 231, 235, 0.9);
    font-size: 12px;
    line-height: 1.45;
    overflow: auto;
    max-height: 320px;
}

@media (max-width: 920px) {
    .logs-layout { grid-template-columns: 1fr; }
    .logs-date-range { grid-template-columns: 1fr; }
} 






/* =========================
   Automation module
   ========================= */

.module--automation .card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
}

.module--automation .card h3 {
    margin: 0 0 8px;
    font-size: 18px;
    letter-spacing: -0.02em;
}

.module--automation .card p {
    margin: 0;
    color: var(--muted);
    line-height: 1.55;
}

.module--automation .form-row label {
    display: flex;
    align-items: center;
    gap: 10px;
}

.module--automation .form-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
}

.module--automation .form-row input[type="number"] {
    max-width: 180px;
}

.module--automation .button {
    width: 100%;
}

.module--automation form + form {
    margin-top: 10px;
}

.module--automation .notice {
    margin-top: 14px;
}

/* Report block */
.module--automation .badge {
    margin-right: 8px;
    margin-bottom: 8px;
}

.module--automation .table-wrap {
    margin-top: 12px;
    border-radius: var(--radius-md);
}

.module--automation .data-table {
    min-width: 0; /* let it shrink on small screens */
}

.module--automation .data-table th:first-child,
.module--automation .data-table td:first-child {
    width: 220px;
}

.module--automation code {
    background: rgba(2, 6, 23, 0.9);
}

/* Make report table feel tighter */
.module--automation .data-table th,
.module--automation .data-table td {
    padding: 12px 14px;
}

/* Responsive */
@media (max-width: 920px) {
    .module--automation .card-grid {
        grid-template-columns: 1fr;
    }

    .module--automation .form-row input[type="number"] {
        max-width: 100%;
    }

    .module--automation .data-table th:first-child,
    .module--automation .data-table td:first-child {
        width: 180px;
    }
}

@media (max-width: 560px) {
    .module--automation .data-table th,
    .module--automation .data-table td {
        padding: 10px 12px;
    }

    .module--automation .card h3 {
        font-size: 17px;
    }
} 




/* =========================
   Automation module
   (append to styles.css)
========================= */

.module--automation .card-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
}

.module--automation .card h3 {
  margin: 0 0 8px;
}

/* Make the "run in new tab" button area clearer */
.module--automation form[target="_blank"] .button {
  width: 100%;
}

/* Slight emphasis for status badges row */
.module--automation #auto-state p {
  margin: 10px 0;
}

.module--automation #auto-state code {
  display: inline-block;
  max-width: 100%;
}

/* Make “Журнал событий” more readable */
.module--automation #auto-events .data-table th,
.module--automation #auto-events .data-table td {
  padding: 12px 14px;
}

.module--automation #auto-events .data-table td strong {
  color: var(--text-strong);
}

.module--automation #auto-events .data-table td small {
  display: inline-block;
  margin-top: 4px;
}

/* Keep details column tidy */
.module--automation #auto-events td:last-child {
  overflow-wrap: anywhere;
  line-height: 1.45;
}

/* Empty-state inside table cell: make it look like inline message */
.module--automation #auto-events .empty-state {
  border: 0;
  background: transparent;
  padding: 10px 0;
}

/* Optional: compact notices inside cards */
.module--automation .card .notice {
  margin-top: 12px;
}

/* Better checkbox line spacing inside forms */
.module--automation .form-row label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

/* Responsive: stack cards on mobile */
@media (max-width: 920px) {
  .module--automation .card-grid {
    grid-template-columns: 1fr;
  }

  .module--automation form[target="_blank"] .button {
    width: 100%;
  }
} 







/* extracted from inline styles in dashboard/view.php */

/* small muted text */
.ui-muted-soft { color: var(--muted-soft); }

/* common sizes */
.ui-text-13 { font-size: 13px; }
.ui-text-12_5 { font-size: 12.5px; }

/* monospace helpers */
.ui-mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

/* spacing helpers (replaces <div style="height: ...">) */
.ui-spacer-10 { height: 10px; }
.ui-spacer-12 { height: 12px; }
.ui-spacer-16 { height: 16px; }
.ui-mt-12 { margin-top: 12px; }

/* replaces inline flex for badges */
.ui-flex-badges {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* replaces inline th widths */
.w-70  { width: 70px; }
.w-140 { width: 140px; }
.w-180 { width: 180px; }
.w-190 { width: 190px; }
.w-220 { width: 220px; }
.w-260 { width: 260px; }




