/* ============================================================
   Manifest Portal Theme — UI only, no logic changes
   ============================================================ */

:root {
    --brand: #1a2e5a;
    --brand-mid: #2a4a8a;
    --accent: #e8a020;
    --danger: #e05050;
    --success: #3cb87a;
    --warning: #e8a020;
    --bg: #f4f6fb;
    --card: #fff;
    --border: #dde3ef;
    --text: #1a2033;
    --muted: #6b7799;
    --sw: 230px;
}

body {
    font-family: 'Segoe UI', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    display: flex;
    min-height: 100vh;
    font-size: 14px;
    margin: 0;
    padding: 0 !important;
}

/* ---- Sidebar ---- */
.sidebar {
    width: var(--sw);
    background: var(--brand);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    z-index: 200;
    overflow-y: auto;
}

.logo { padding: 18px 16px 14px; border-bottom: 1px solid rgba(255,255,255,.1); }
.logo-mark { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.logo-icon {
    width: 36px; height: 36px; flex-shrink: 0;
    border-radius: 7px; overflow: hidden;
    display: flex; align-items: center; justify-content: center;
    background: var(--accent);
}
.logo-icon img { width: 100%; height: 100%; object-fit: contain; }
.logo-text { color: #fff; font-weight: 700; font-size: 14px; }
.logo-sub  { color: rgba(255,255,255,.45); font-size: 10px; text-transform: uppercase; letter-spacing: .5px; }

.nav-sec {
    padding: 12px 12px 3px;
    color: rgba(255,255,255,.4);
    font-size: 10px; font-weight: 600;
    letter-spacing: 1px; text-transform: uppercase;
}

/* sidebar nav links */
.sb-link {
    display: flex; align-items: center; gap: 9px;
    padding: 8px 12px; margin: 1px 5px;
    border-radius: 7px;
    color: rgba(255,255,255,.75); font-size: 13px;
    text-decoration: none; cursor: pointer;
    transition: all .15s;
}
.sb-link:hover { background: rgba(255,255,255,.08); color: #fff; text-decoration: none; }
.sb-link.active { background: rgba(255,255,255,.15); color: #fff; font-weight: 600; }

/* sidebar group (collapsible) */
.sb-group-hd {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 12px; margin: 1px 5px;
    border-radius: 7px;
    color: rgba(255,255,255,.75); font-size: 13px;
    cursor: pointer; transition: all .15s;
}
.sb-group-hd:hover { background: rgba(255,255,255,.08); color: #fff; }
.sb-group-left { display: flex; align-items: center; gap: 9px; }
.sb-arrow { font-size: 9px; color: rgba(255,255,255,.4); transition: transform .2s; }
.sb-group-hd.open .sb-arrow { transform: rotate(90deg); }

.sb-children { display: none; margin: 1px 5px 2px 14px; }
.sb-children.open { display: block; }

.sb-child {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 12px; border-radius: 6px;
    color: rgba(255,255,255,.6); font-size: 12px;
    text-decoration: none; cursor: pointer;
    transition: all .15s;
    border-left: 2px solid rgba(255,255,255,.1);
    margin-left: 8px;
}
.sb-child:hover { background: rgba(255,255,255,.07); color: #fff; border-left-color: rgba(255,255,255,.3); text-decoration: none; }
.sb-child.active { background: rgba(255,255,255,.12); color: #fff; font-weight: 600; border-left-color: var(--accent); }

.sidebar-foot {
    margin-top: auto; padding: 12px;
    border-top: 1px solid rgba(255,255,255,.1);
    display: flex; align-items: center; gap: 9px;
}
.sb-avatar {
    width: 30px; height: 30px; border-radius: 50%;
    background: var(--brand-mid); border: 2px solid rgba(255,255,255,.2);
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 700; font-size: 11px; flex-shrink: 0;
}
.sb-user-name { color: rgba(255,255,255,.8); font-size: 12px; }
.sb-user-role { color: rgba(255,255,255,.45); font-size: 10px; }

/* sign-out link in sidebar foot */
.sb-signout {
    color: rgba(255,255,255,.5); font-size: 11px;
    text-decoration: none; cursor: pointer;
    transition: color .15s;
}
.sb-signout:hover { color: #fff; text-decoration: none; }

/* ---- Main area ---- */
.main {
    margin-left: var(--sw);
    flex: 1; min-width: 0;
    max-width: calc(100vw - var(--sw));
    overflow-x: hidden;
    display: flex; flex-direction: column;
    min-height: 100vh; /* ensures footer is always at the bottom */
}

/* ---- Topbar ---- */
.topbar {
    background: var(--card);
    border-bottom: 1px solid var(--border);
    padding: 0 22px; height: 54px;
    display: flex; align-items: center; gap: 12px;
    position: sticky; top: 0; z-index: 50;
}
.topbar-title { font-weight: 700; font-size: 15px; color: var(--brand); flex: 1; }

/* ---- Page content ---- */
.content { padding: 22px; flex: 1; }

/* ---- Page header ---- */
.page-header { margin-bottom: 18px; }
.page-header h1 { font-size: 19px; font-weight: 800; color: var(--brand); margin: 0; }
.page-header p  { color: var(--muted); font-size: 13px; margin-top: 3px; }

/* ---- Theme card ---- */
.theme-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 11px; padding: 18px;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
}

/* ---- Theme table ---- */
.tw { overflow-x: auto; }
.theme-table { width: 100%; border-collapse: collapse; }
.theme-table th {
    text-align: left; font-size: 11px; font-weight: 600;
    color: var(--muted); text-transform: uppercase; letter-spacing: .5px;
    padding: 9px 12px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.theme-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 13px; vertical-align: middle; }
.theme-table tr:last-child td { border-bottom: none; }
.theme-table tr:hover td { background: #f8f9fc; }

/* ---- Section title ---- */
.section-title { font-size: 14px; font-weight: 700; color: var(--brand); margin-bottom: 11px; }

/* ---- DevExtreme overrides ---- */
.dx-datagrid-headers { background: var(--bg) !important; }
.dx-datagrid-headers .dx-header-row td {
    color: var(--muted) !important; font-size: 11px !important;
    font-weight: 600 !important; text-transform: uppercase; letter-spacing: .5px;
}

/* Badge pill shape inside grid rows — matches reference theme */
.dx-data-row .badge { border-radius: 20px; }

/* ---- Accordion theme tweaks ---- */
.accordion-button:not(.collapsed) { background: var(--bg); color: var(--brand); box-shadow: none; }
.accordion-button:focus { box-shadow: none; border-color: var(--border); }
.accordion-item { border-color: var(--border); }

/* ---- Flush card variant ---- */
/* Card has no base padding; toolbar and grid-wrap control their own spacing */
.theme-card-flush {
    padding: 0;
    overflow: hidden;
}

/* Toolbar row (e.g. "Add Workflow" button) inside a flush card */
.theme-card-flush .card-toolbar {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Grid wrapper — provides breathing room on all sides so grid never
   touches the card border. Search panel right edge also stays clear. */
.grid-wrap {
    padding: 14px;
}

/* Standard card overflow fix */
.theme-card { overflow: hidden; }

/* ---- Footer — always at bottom of .main via flexbox ---- */
.main-footer {
    margin-top: auto; /* push footer to bottom when content is short */
    border-top: 1px solid var(--border);
    padding: 12px 22px;
    font-size: 12px;
    color: var(--muted);
    text-align: center;
    background: var(--card);
    flex-shrink: 0;
}

/* ---- Auth layout (login / register — no sidebar) ---- */
.auth-body {
    display: block;
    background: linear-gradient(135deg, var(--brand) 0%, var(--brand-mid) 60%, #3a6abf 100%);
    min-height: 100vh;
}
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
}

/* ---- Login page ---- */
.login-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 200px);
    padding: 24px;
}

.login-card {
    background: var(--card);
    border: none;
    border-radius: 14px;
    padding: 40px 44px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 12px 48px rgba(0,0,0,.25);
}

.login-brand {
    text-align: center;
    margin-bottom: 28px;
}
.login-brand img {
    height: 48px;
    margin-bottom: 10px;
}
.login-brand-text {
    font-weight: 800;
    font-size: 17px;
    color: var(--brand);
}
.login-brand-sub {
    font-size: 11px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .5px;
}

.login-heading {
    font-size: 20px;
    font-weight: 800;
    color: var(--brand);
    margin: 0 0 4px;
}
.login-sub {
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 24px;
}

.login-form { display: flex; flex-direction: column; gap: 0; }

.login-field { margin-bottom: 16px; }
.login-field label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 5px;
}
.login-input {
    width: 100%;
    padding: 9px 12px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit;
    outline: none;
    transition: border-color .15s;
    background: var(--bg);
    color: var(--text);
}
.login-input:focus { border-color: var(--brand); background: #fff; }
.login-input::placeholder { color: var(--muted); }

.login-error {
    background: #fdeaea;
    border: 1px solid #fca5a5;
    border-radius: 7px;
    padding: 9px 12px;
    font-size: 12px;
    color: #b03030;
    margin-bottom: 16px;
}
.login-field-error { font-size: 11px; color: var(--danger); margin-top: 3px; display: block; }

.login-btn {
    width: 100%;
    padding: 10px;
    background: var(--brand);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: background .15s;
    margin-top: 8px;
}
.login-btn:hover { background: var(--brand-mid); }

.login-links {
    display: flex;
    justify-content: space-between;
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid var(--border);
}
.login-links a {
    font-size: 12px;
    color: var(--brand);
    text-decoration: none;
    font-weight: 500;
}
.login-links a:hover { text-decoration: underline; }
