:root {
    --bg: #f3f6fb;
    --panel: #ffffff;
    --panel-soft: #f8fafc;
    --text: #162033;
    --muted: #64748b;
    --line: #dbe3ef;
    --primary: #1d4ed8;
    --primary-dark: #163fae;
    --secondary: #e5edf9;
    --secondary-text: #274060;
    --danger: #b42318;
    --danger-bg: #fef3f2;
    --success: #067647;
    --success-bg: #ecfdf3;
    --sidebar: #0f172a;
    --sidebar-accent: #1e293b;
    --shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
}

* { box-sizing: border-box; }
html,
body {
    height: 100%;
}

body {
    margin: 0;
    font-family: "Segoe UI", Arial, sans-serif;
    background: linear-gradient(180deg, #eef4ff 0%, var(--bg) 180px);
    color: var(--text);
    overflow: hidden;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0 0 12px; font-weight: 700; color: #0f172a; }
p { margin: 0 0 14px; color: var(--muted); }

.app-shell {
    display: flex;
    height: 100vh;
}

.app-sidebar {
    width: 250px;
    background: linear-gradient(180deg, var(--sidebar) 0%, #111827 100%);
    color: #fff;
    padding: 28px 20px;
    position: fixed;
    inset: 0 auto 0 0;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-weight: 700;
    letter-spacing: 0.08em;
}

.brand-copy strong {
    display: block;
    font-size: 0.95rem;
    letter-spacing: 0.08em;
}

.brand-copy span {
    display: block;
    margin-top: 4px;
    color: rgba(226, 232, 240, 0.72);
    font-size: 0.86rem;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 20px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-right: 2px;
}

.sidebar-section + .sidebar-section {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid rgba(148, 163, 184, 0.14);
}

.sidebar-section-label {
    margin: 0 12px 8px;
    font-size: 0.73rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(148, 163, 184, 0.82);
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 12px 14px;
    border-radius: 12px;
    color: rgba(226, 232, 240, 0.92);
    background: transparent;
    transition: background 0.15s ease, color 0.15s ease;
}

.nav-link:hover,
.nav-link.active {
    background: rgba(148, 163, 184, 0.16);
    color: #fff;
    text-decoration: none;
}

.sidebar-footer {
    margin-top: 20px;
    padding-top: 12px;
    border-top: 1px solid rgba(148, 163, 184, 0.18);
}

.app-main {
    margin-left: 250px;
    width: calc(100% - 250px);
    padding: 28px;
    height: 100vh;
    min-height: 0;
    overflow-y: auto;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 28px;
}

.topbar-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
}

.page-intro h1 {
    font-size: 1.9rem;
    margin-bottom: 6px;
}

.page-intro p {
    margin-bottom: 0;
}

.topbar-user {
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(29, 78, 216, 0.08);
    color: var(--secondary-text);
    font-weight: 600;
}

.system-clock {
    min-width: 250px;
    max-width: min(100%, 520px);
    padding: 14px 16px;
    border-radius: 16px;
    background: linear-gradient(135deg, #0f172a 0%, #1d4ed8 100%);
    color: #fff;
    box-shadow: var(--shadow);
}

.system-clock-company {
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.35;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.system-clock-date {
    margin-top: 10px;
    font-size: 0.92rem;
    font-weight: 600;
    opacity: 0.88;
}

.system-clock-time {
    margin-top: 4px;
    font-size: 1.8rem;
    font-weight: 700;
    line-height: 1.1;
}

.system-clock-zone {
    margin-top: 8px;
    font-size: 0.86rem;
    opacity: 0.84;
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

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

.metric-card,
.panel,
.card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: var(--shadow);
}

.metric-card {
    padding: 20px;
}

.metric-label {
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    margin-bottom: 10px;
}

.metric-value {
    font-size: 1.9rem;
    font-weight: 700;
    color: #0f172a;
}

.panel,
.card {
    padding: 24px;
    margin-bottom: 22px;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
}

.panel-title {
    margin: 0;
    font-size: 1.15rem;
}

.panel-subtitle {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 0.95rem;
}

.stack {
    display: grid;
    gap: 18px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.field {
    display: grid;
    gap: 8px;
}

.field.full {
    grid-column: 1 / -1;
}

label {
    font-size: 0.92rem;
    font-weight: 600;
    color: #334155;
}

input,
select,
textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    background: #fff;
    color: var(--text);
    font-size: 0.96rem;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: rgba(29, 78, 216, 0.55);
    box-shadow: 0 0 0 4px rgba(29, 78, 216, 0.12);
}

.form-actions,
.inline-actions,
.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.btn,
button,
input[type=submit] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 0;
    border-radius: 12px;
    padding: 11px 16px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
}

.btn-primary,
button,
input[type=submit] {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover,
button:hover,
input[type=submit]:hover {
    background: var(--primary-dark);
    text-decoration: none;
}

.btn-secondary {
    background: var(--secondary);
    color: var(--secondary-text);
}

.btn-secondary:hover {
    background: #d9e7fb;
    text-decoration: none;
}

.btn-danger {
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid #fecdca;
}

.btn-danger:hover {
    background: #fee4e2;
    text-decoration: none;
}

.msg-success,
.msg-error,
.notice {
    padding: 14px 16px;
    border-radius: 14px;
    margin-bottom: 18px;
    border: 1px solid transparent;
}

.msg-success {
    color: var(--success);
    background: var(--success-bg);
    border-color: #abefc6;
}

.msg-error {
    color: var(--danger);
    background: var(--danger-bg);
    border-color: #fecdca;
}

.notice {
    color: var(--secondary-text);
    background: #eff6ff;
    border-color: #bfdbfe;
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 16px;
    overflow: hidden;
}

th,
td {
    padding: 14px 16px;
    border-bottom: 1px solid #e5edf6;
    vertical-align: top;
    text-align: left;
}

th {
    background: var(--panel-soft);
    color: #475569;
    font-size: 0.83rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

tr:last-child td {
    border-bottom: 0;
}

.table-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.data-list {
    display: grid;
    gap: 14px;
}

.data-row {
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e5edf6;
}

.data-row:last-child {
    padding-bottom: 0;
    border-bottom: 0;
}

.data-label {
    color: var(--muted);
    font-weight: 600;
}

.badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 5px 10px;
    font-size: 0.82rem;
    font-weight: 700;
}

.badge-active {
    background: #dcfce7;
    color: #166534;
}

.badge-inactive {
    background: #fee2e2;
    color: #991b1b;
}

.muted {
    color: var(--muted);
}

.empty-state {
    padding: 28px;
    text-align: center;
    color: var(--muted);
    background: var(--panel-soft);
    border: 1px dashed #cbd5e1;
    border-radius: 16px;
}

@media (max-width: 980px) {
    body {
        overflow: auto;
    }

    .app-sidebar {
        position: static;
        width: 100%;
        min-height: auto;
        height: auto;
        overflow: visible;
    }

    .app-shell {
        display: block;
    }

    .app-main {
        margin-left: 0;
        width: 100%;
        padding: 20px;
        height: auto;
        overflow: visible;
    }

    .grid-2,
    .form-grid {
        grid-template-columns: 1fr;
    }

    .topbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .topbar-meta {
        width: 100%;
        align-items: flex-start;
    }

    .system-clock {
        width: 100%;
        max-width: none;
    }
}
