﻿

:root {
    --maroon: #8C1420;
    --maroon-dark: #6B0F18;
    --maroon-tint: #F5E6E8;
    --maroon-soft: rgba(140, 20, 32, 0.08);
    --bg: #F7F8FA;
    --surface: #FFFFFF;
    --border: #E5E7EB;
    --text: #1A1A1A;
    --muted: rgba(0, 0, 0, 0.6);
    --success: #1E9E5A;
    --warning: #E0A400;
    --info: #2B6CB0;
    --error: #D64545;
    --shadow: 0 18px 50px rgba(20, 24, 35, 0.08);
    --shadow-soft: 0 10px 24px rgba(20, 24, 35, 0.06);
    --radius: 12px;
    --radius-lg: 4px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Segoe UI Variable", "Segoe UI", Inter, Roboto, sans-serif;
    background:
        radial-gradient(circle at top left, rgba(140, 20, 32, 0.08), transparent 30%),
        linear-gradient(180deg, #fafafb 0%, var(--bg) 100%);
    color: var(--text);
    font-size: 15px;
    line-height: 1.5;
}

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

.app-shell__content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.body--centered {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    text-decoration: none;
    font-weight: 700;
}

.brand--sidebar {
    color: #fff;
    margin-bottom: 22px;
}

.brand__mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.18);
    font-size: 13px;
    letter-spacing: 0.5px;
}

.brand__mark--lg {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    background: var(--maroon);
    color: #fff;
    font-size: 20px;
}

.sidebar {
    width: 260px;
    background: linear-gradient(180deg, var(--maroon) 0%, var(--maroon-dark) 100%);
    color: #fff;
    padding: 24px 18px 18px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.sidebar__user {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    padding: 14px;
}

.sidebar__label {
    display: block;
    font-size: 12px;
    color: white;
    margin-bottom: 4px;
}

.sidebar__email {
    display: block;
    font-size: 14px;
    font-weight: 700;
    word-break: break-word;
}

.sidebar__nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebar__link {
    display: flex;
    align-items: center;
    gap: 12px;
    color: rgba(255, 255, 255, 0.86);
    text-decoration: none;
    padding: 12px 14px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 14px;
}

.sidebar__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.14);
}

.sidebar__link:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }
.sidebar__link.is-active { background: rgba(255, 255, 255, 0.18); color: #fff; }

.sidebar__footer {
    margin-top: auto;
    padding-top: 12px;
}

/* ------------------------------------------------------------- structure */

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 26px 24px 60px;
    width: 100%;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 18px 24px;
    background: rgba(247, 248, 250, 0.86);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(229, 231, 235, 0.8);
}

.topbar__search {
    flex: 1;
    max-width: 300px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 16px;
    min-height: 50px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    box-shadow: var(--shadow-soft);
}

.topbar__search-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--maroon);
    flex: 0 0 auto;
}

.topbar__search-input {
    width: 100%;
    border: 0;
    outline: 0;
    background: transparent;
    font: inherit;
    color: var(--text);
}

.topbar__search-input::placeholder { color: #9098a6; }

.topbar__actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.topbar__icon-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--maroon);
    box-shadow: var(--shadow-soft);
}

.topbar__icon-btn:hover {
    background: var(--maroon-tint);
}

.topbar__badge {
    position: absolute;
    top: 6px;
    right: 6px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 8px;
    background: var(--maroon);
    color: #fff;
    font-size: 11px;
    line-height: 18px;
}

.profile-chip {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 7px 14px 7px 7px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    box-shadow: var(--shadow-soft);
}

.profile-chip__avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: var(--maroon-tint);
    color: var(--maroon);
    font-size: 12px;
    font-weight: 800;
}

.profile-chip__meta { display: flex; flex-direction: column; line-height: 1.1; }
.profile-chip__name { font-size: 13px; font-weight: 700; }
.profile-chip__role { font-size: 11px; color: var(--muted); }

.icon {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.page-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 22px;
}

.h1 { font-size: 24px; font-weight: 800; margin: 0 0 4px; }
.h2 { font-size: 17px; font-weight: 700; margin: 0 0 14px; }

.muted { color: var(--muted); margin: 0; }
.small { font-size: 12.5px; }
.strong { font-weight: 700; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.inline { display: inline; }

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 22px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-soft);
}

.card--narrow { max-width: 460px; }
.card--form { max-width: 680px; }
.card--danger { border-color: rgba(214, 69, 69, 0.35); }
.card--hero { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }

.footer {
    text-align: center;
    color: var(--muted);
    font-size: 12.5px;
    padding: 20px;
    margin-top: auto;
}

/* ----------------------------------------------------------------- login */

.login { width: 100%; max-width: 400px; }
.login__brand { text-align: center; margin-bottom: 20px; }
.login__title { font-size: 22px; font-weight: 800; margin: 12px 0 2px; color: var(--maroon); }
.login__note { text-align: center; font-size: 12.5px; margin-top: 16px; }

/* ----------------------------------------------------------------- stats */

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 20px; }
.stats--dashboard { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    box-shadow: var(--shadow-soft);
}

.stat--accent { background: linear-gradient(180deg, #fff 0%, rgba(245, 230, 232, 0.42) 100%); }
.stat__icon {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}
.stat__icon--maroon { background: var(--maroon-soft); color: var(--maroon); }
.stat__icon--green { background: rgba(30, 158, 90, 0.12); color: var(--success); }
.stat__icon--blue { background: rgba(43, 108, 176, 0.12); color: var(--info); }
.stat__icon--amber { background: rgba(224, 164, 0, 0.14); color: var(--warning); }

.stat__value { display: block; font-size: 28px; font-weight: 800; color: var(--maroon); }
.stat__value--ok { color: var(--success); }
.stat__value--warn { color: var(--warning); }
.stat__label { color: var(--muted); font-size: 13px; }

.eyebrow {
    margin: 0 0 6px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--maroon);
}

.hero__content { max-width: 760px; }
.hero__description { margin: 0; color: var(--muted); font-size: 15px; max-width: 720px; }
.hero__meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.hero__actions { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.hero__note { margin: 0; text-align: right; max-width: 220px; }

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

.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.65fr) minmax(320px, 0.95fr);
    gap: 20px;
    align-items: start;
}

.dashboard-grid__main,
.dashboard-grid__side { min-width: 0; }

.dashboard-grid__side { display: grid; gap: 20px; }

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

/* ----------------------------------------------------------------- table */

.table { width: 100%; border-collapse: collapse; }
.table th {
    text-align: left;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--muted);
    padding: 0 12px 10px;
    border-bottom: 1px solid var(--border);
}
.table td { padding: 14px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table--dashboard th:first-child,
.table--dashboard td:first-child { padding-left: 0; }
.table--dashboard th:last-child,
.table--dashboard td:last-child { padding-right: 0; }

.table__separator { color: var(--border); margin: 0 10px; }

.svc { display: flex; align-items: center; gap: 12px; }
.svc__icon { width: 38px; height: 38px; border-radius: 12px; object-fit: cover; background: var(--maroon-tint); }
.svc__icon--placeholder {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--maroon);
    font-weight: 800;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 10px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    border: 1px solid transparent;
    white-space: nowrap;
}

.badge--success { background: rgba(30, 158, 90, 0.12); color: #146c3e; border-color: rgba(30, 158, 90, 0.2); }
.badge--warning { background: rgba(224, 164, 0, 0.14); color: #8a6400; border-color: rgba(224, 164, 0, 0.24); }
.badge--danger { background: rgba(214, 69, 69, 0.12); color: #9f3635; border-color: rgba(214, 69, 69, 0.22); }
.badge--info { background: rgba(43, 108, 176, 0.12); color: #21558b; border-color: rgba(43, 108, 176, 0.2); }
.badge--active { background: rgba(30, 158, 90, 0.12); color: #146c3e; border-color: rgba(30, 158, 90, 0.2); }
.badge--connected { background: rgba(43, 108, 176, 0.12); color: #21558b; border-color: rgba(43, 108, 176, 0.2); }
.badge--offline { background: rgba(214, 69, 69, 0.12); color: #9f3635; border-color: rgba(214, 69, 69, 0.22); }
.badge--pending { background: rgba(224, 164, 0, 0.14); color: #8a6400; border-color: rgba(224, 164, 0, 0.24); }
.badge--inactive { background: rgba(107, 114, 128, 0.12); color: #4b5563; border-color: rgba(107, 114, 128, 0.22); }

.chart {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    align-items: end;
    gap: 12px;
    min-height: 220px;
    margin-top: 12px;
}

.chart__column {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.chart__bars {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: end;
    gap: 8px;
    width: 100%;
    min-height: 170px;
    padding: 14px 10px 10px;
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(140, 20, 32, 0.04), rgba(140, 20, 32, 0.01));
}

.chart__bar {
    border-radius: 14px 14px 6px 6px;
    align-self: end;
    min-height: 8px;
}

.chart__bar--services { background: linear-gradient(180deg, #b31d2d 0%, var(--maroon) 100%); }
.chart__bar--transactions { background: linear-gradient(180deg, #f5be58 0%, #d89200 100%); }

.chart__label { font-size: 12px; color: var(--muted); }

.chart__legend {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-top: 12px;
    color: var(--muted);
    font-size: 12px;
}

.legend-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 8px;
    margin-right: 7px;
}

.legend-dot--services { background: var(--maroon); }
.legend-dot--transactions { background: #d89200; }

.activity-list { display: grid; gap: 14px; margin-top: 8px; }

.activity-item {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.activity-item__dot {
    width: 12px;
    height: 12px;
    margin-top: 7px;
    border-radius: 8px;
    flex: 0 0 auto;
    box-shadow: 0 0 0 4px rgba(140, 20, 32, 0.08);
}

.activity-item__dot--active,
.activity-item__dot--connected { background: var(--success); }
.activity-item__dot--pending { background: var(--warning); }
.activity-item__dot--offline { background: var(--error); }

.activity-item__content { min-width: 0; flex: 1; }
.activity-item__title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 6px;
}
.activity-item__time { display: block; margin-top: 6px; color: var(--muted); font-size: 12px; }

.toast-stack {
    position: fixed;
    top: 86px;
    right: 24px;
    z-index: 50;
    display: grid;
    gap: 12px;
    width: min(420px, calc(100vw - 48px));
}

.toast {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 18px;
    border-radius: 18px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.98);
    box-shadow: var(--shadow);
}

.toast__body { display: grid; gap: 4px; }
.toast__eyebrow { font-size: 11px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--maroon); }
.toast__message { font-size: 14px; color: var(--text); }
.toast__close {
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: 22px;
    line-height: 1;
    padding: 0;
}

.toast--success { border-left: 4px solid var(--success); }
.toast--error { border-left: 4px solid var(--error); }
.toast--warning { border-left: 4px solid var(--warning); }
.toast--info { border-left: 4px solid var(--info); }

/* ---------------------------------------------------------------- forms */

.form { display: block; }

.label { display: block; font-size: 12px; font-weight: 700; letter-spacing: 0.3px;
         text-transform: uppercase; color: var(--muted); margin: 16px 0 6px; }

.input {
    width: 100%;
    padding: 11px 13px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
    font-size: 14.5px;
    font-family: inherit;
    color: var(--text);
}

.input:focus { outline: none; border-color: var(--maroon); box-shadow: 0 0 0 3px rgba(140, 20, 32, 0.1); }
.input--error { border-color: var(--error); }
.textarea { resize: vertical; }

.hint { color: var(--muted); font-size: 12.5px; margin: 6px 0 0; }
.field-error { color: var(--error); font-size: 12.5px; margin: 6px 0 0; }
.req { color: var(--error); }

.auth-block {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 4px 18px 18px;
    margin-top: 18px;
}

.auth-block legend { font-size: 12.5px; font-weight: 700; color: var(--maroon); padding: 0 8px; }

.form__actions { display: flex; gap: 10px; margin-top: 26px; }

/* --------------------------------------------------------------- buttons */

.btn {
    display: inline-block;
    padding: 11px 18px;
    border-radius: 10px;
    border: 1px solid transparent;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
}

.btn--primary { background: var(--maroon); color: #fff; }
.btn--primary:hover { background: var(--maroon-dark); }

.btn--ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn--ghost:hover { background: var(--bg); }

.btn--danger { background: transparent; border-color: rgba(214, 69, 69, 0.4); color: var(--error); }
.btn--danger:hover { background: rgba(214, 69, 69, 0.08); }

.btn--sm { padding: 7px 12px; font-size: 13px; }
.btn--block { width: 100%; margin-top: 22px; }

.sidebar .btn--ghost { border-color: rgba(255, 255, 255, 0.4); color: #fff; }
.sidebar .btn--ghost:hover { background: rgba(255, 255, 255, 0.14); }

.link { color: var(--maroon); font-weight: 600; text-decoration: none; }
.link:hover { text-decoration: underline; }

/* ---------------------------------------------------------------- alerts */

.alert { padding: 13px 16px; border-radius: 10px; margin-bottom: 18px; font-size: 14px; }
.alert--success { background: rgba(30, 158, 90, 0.1); color: #146c3e; }
.alert--error   { background: rgba(214, 69, 69, 0.1); color: #97302f; }
.alert--warning { background: rgba(224, 164, 0, 0.12); color: #8a6400; }
.alert--info    { background: var(--maroon-tint); color: var(--maroon-dark); }

/* Responsive additions - append to your existing app.css */

/* Large tablets */
@media (max-width: 992px){
  .container{padding:22px 18px;}
  .stats--dashboard{grid-template-columns:repeat(2,minmax(0,1fr));}
  .stats{grid-template-columns:repeat(2,minmax(0,1fr));}
  .dashboard-grid{grid-template-columns:1fr;}
  .card--hero,.page-head{flex-direction:column;}
  .hero__actions{align-items:flex-start;}
  .table{min-width:700px;}
}

/* Tablets / phones */
@media (max-width:768px){
  .app-shell{flex-direction:column;}
  .sidebar{width:100%;padding:18px;}
  .topbar{position:static;flex-direction:column;align-items:stretch;padding:16px;}
  .topbar__search{max-width:100%;}
  .topbar__actions{justify-content:space-between;flex-wrap:wrap;}
  .container{padding:18px 15px;}
  .stats,.stats--dashboard{grid-template-columns:1fr;}
  .profile-chip{width:100%;justify-content:space-between;}
  .chart{gap:8px;}
  .toast-stack{left:12px;right:12px;width:auto;top:120px;}
}

/* Small phones */
@media (max-width:480px){
  body{font-size:14px;}
  .h1{font-size:22px;}
  .h2{font-size:16px;}
  .btn{width:100%;}
  .form__actions{flex-direction:column;}
  .topbar{padding:12px;}
  .container{padding:15px 12px;}
}

