@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --sidebar-bg: linear-gradient(180deg, #1c2130 0%, #24303a 45%, #1a1f2b 100%);
    --sidebar-text: #d6dae3;
    --sidebar-active: rgba(255, 255, 255, 0.10);
    --brand: #5b5ff5;
    --brand-dark: #4347d9;
    --accent-green: #8bc34a;
    --page-bg: #f3f5f9;
    --card-bg: #ffffff;
    --border: #e5e8ef;
    --text: #1d2130;
    --muted: #5f6677;
    --success-bg: #e3f6e5;
    --success-text: #2e7d32;
    --danger: #d64545;
    --radius: 10px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
    font-size: 14px;
    color: var(--text);
    background: var(--page-bg);
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Shell */
.page { display: flex; min-height: 100vh; }

.sidebar {
    width: 240px;
    flex-shrink: 0;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    padding: 18px 12px;
    position: sticky;
    top: 0;
    height: 100vh;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 20px;
    font-weight: 600;
    color: #fff;
    padding: 0 8px 22px;
}

.brand-mark {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    background: var(--accent-green);
    color: #1c2130;
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 15px;
}

.nav { display: flex; flex-direction: column; gap: 4px; }

.nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    color: var(--sidebar-text);
    font-weight: 500;
}

.nav a:hover { background: rgba(255, 255, 255, 0.06); text-decoration: none; }
.nav a.active { background: var(--sidebar-active); color: #fff; }
.nav svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.6; }

.sidebar-footer {
    margin-top: auto;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding: 14px 8px 0;
    font-size: 13px;
}

.sidebar-footer .user { color: #fff; font-weight: 500; word-break: break-all; margin-bottom: 8px; }
.sidebar-footer a { color: var(--sidebar-text); }
.sidebar-footer small { display: block; margin-top: 14px; opacity: .55; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    height: 56px;
    background: #fff;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 24px;
    color: var(--muted);
}

.content { padding: 20px 24px 40px; max-width: 1200px; width: 100%; }

/* Typography */
h1 { font-size: 26px; font-weight: 700; margin: 8px 0 6px; }
h2 { font-size: 18px; font-weight: 600; margin: 0 0 14px; }
h3 { font-size: 18px; font-weight: 500; margin: 0 0 16px; }
h4 { font-size: 14px; font-weight: 600; margin: 18px 0 10px; color: var(--muted); }

.breadcrumb { font-size: 13px; color: var(--muted); margin-bottom: 4px; }

.page-intro {
    border-left: 3px solid var(--brand);
    padding: 2px 10px;
    color: var(--muted);
    font-size: 13px;
    margin: 0 0 18px;
}

/* Cards */
section, .card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 22px;
    margin-bottom: 18px;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.hero {
    display: flex;
    align-items: center;
    gap: 18px;
    border-left: 4px solid var(--brand);
}

.hero-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    background: var(--brand);
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 24px;
    transform: rotate(-6deg);
}

.hero h2 { margin: 0; font-size: 18px; font-weight: 700; }
.hero .sub { color: var(--muted); font-size: 13px; margin-top: 4px; }
.hero .spacer { flex: 1; }

/* Badges */
.badge {
    display: inline-block;
    padding: 3px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 500;
    background: var(--success-bg);
    color: var(--success-text);
}

.badge.muted { background: #eef0f4; color: var(--muted); }

/* Tables */
table { width: 100%; border-collapse: collapse; }

th {
    text-align: left;
    font-weight: 500;
    color: var(--muted);
    font-size: 13px;
    padding: 10px 8px;
    border-bottom: 1px solid var(--border);
}

td { padding: 10px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fafbfd; }

ul { padding-left: 0; list-style: none; margin: 0; }
ul li { padding: 9px 0; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 8px; }
ul li:last-child { border-bottom: none; }
ul li button { margin-left: auto; }

/* Forms */
form { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 16px; }
form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }

input, select {
    font: inherit;
    padding: 8px 10px;
    border: 1px solid #cfd4de;
    border-radius: 8px;
    background: #fff;
    min-width: 170px;
    color: var(--text);
}

input:focus, select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(91, 95, 245, .15); }
input[readonly] { background: #f7f8fb; font-size: 12px; }
input[type=checkbox] { min-width: 0; }

button {
    font: inherit;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 8px;
    border: 1px solid var(--brand);
    background: var(--brand);
    color: #fff;
    cursor: pointer;
}

button:hover { background: var(--brand-dark); }
button:disabled { opacity: .55; cursor: default; }

td button, li button {
    background: #fff;
    color: var(--brand);
    padding: 5px 12px;
    font-size: 13px;
}

td button:hover, li button:hover { background: #f0f1fe; }

.validation-summary-errors, .validation-errors, .validation-message, .field-validation-error { color: var(--danger); font-size: 13px; }
.validation-errors { width: 100%; margin: 0; }

p[role=alert] {
    background: #fdecec;
    color: #a12b2b;
    border: 1px solid #f5c6c6;
    border-radius: 8px;
    padding: 10px 14px;
}

p[role=status] {
    background: var(--success-bg);
    color: var(--success-text);
    border: 1px solid #c3e6c6;
    border-radius: 8px;
    padding: 10px 14px;
}

code { background: #f1f2f6; padding: 2px 6px; border-radius: 4px; }

/* Standalone account pages */
.auth-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: var(--sidebar-bg);
    padding: 20px;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: #fff;
    border-radius: 14px;
    padding: 32px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
}

.auth-card .brand { color: var(--text); padding: 0 0 18px; }
.auth-card form { flex-direction: column; align-items: stretch; }
.auth-card form label { color: var(--text); font-weight: 500; }
.auth-card input { width: 100%; }
.auth-card input[type=checkbox] { width: auto; }
.auth-card button { width: 100%; padding: 10px; margin-top: 6px; }

.brand-logo { height: 36px; width: auto; display: block; }
.auth-card .brand { background: var(--sidebar-bg); margin: -32px -32px 20px; padding: 20px 32px; border-radius: 14px 14px 0 0; justify-content: center; }
.auth-card .brand-logo { height: 44px; }


.sidebar-devotech-logo { height: 28px; width: auto; display: block; margin: 0 0 8px; }
.sidebar-brand-footer { margin-top: auto; padding: 16px 8px 0; font-size: 12px; }
.sidebar-footer + .sidebar-brand-footer { margin-top: 0; }
.sidebar-brand-footer small { display: block; opacity: .55; color: var(--sidebar-text); }

.welcome { max-width: 560px; margin: 48px auto; text-align: center; }
.welcome-signin {
    display: block;
    padding: 16px 24px;
    border-radius: 999px;
    background: #4468c8;
    color: #fff;
    font-size: 20px;
    font-weight: 500;
    text-decoration: none;
    transition: background .15s;
}
.welcome-signin:hover { background: #3656ad; color: #fff; }
.welcome-terms { margin: 24px 0 40px; font-size: 16px; line-height: 1.6; color: var(--text); text-align: left; }
.welcome-terms a { color: #4468c8; font-weight: 600; text-decoration: underline; }
.welcome-powered { display: flex; align-items: center; justify-content: center; gap: 14px; color: #9aa3b5; font-size: 18px; }
.welcome-powered img { height: 40px; width: auto; }
.topbar { font-size: 22px; font-weight: 700; color: var(--text); }

/* Company page */
.content:has(.company-header) { max-width: none; }

.company-header { display: flex; align-items: flex-start; gap: 24px; margin-bottom: 8px; }
.company-header-text { flex: 1; }
.company-header h1 { font-size: 30px; margin-top: 0; }

button.secondary { background: #fff; color: var(--brand); }
button.secondary:hover { background: #f0f1fe; }
button.link { background: none; border: none; color: var(--text); padding: 6px 4px; }
button.link:hover { background: none; color: var(--brand); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; }
.tabs .tab {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    color: var(--muted);
    padding: 12px 24px;
}
.tabs .tab:hover { background: none; color: var(--text); }
.tabs .tab.active { color: var(--brand); border-bottom-color: var(--brand); }

.section-header { display: flex; align-items: flex-start; gap: 14px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.section-header h3 { margin: 0 0 6px; font-size: 20px; }
.section-header .page-intro { margin: 0; }
.section-icon {
    width: 46px;
    height: 46px;
    border-radius: 8px;
    background: transparent;
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 26px;
    flex-shrink: 0;
    object-fit: contain;
}

.grid-toolbar { display: flex; justify-content: flex-end; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--border); }

table.grid th, table.grid td { padding: 12px 16px; }
table.grid th.num, table.grid td.num { text-align: right; }
table.grid tr.filters th { background: #f7f8fb; font-weight: 400; }
table.grid tr.filters input, table.grid tr.filters select { min-width: 0; width: 100%; padding: 6px 8px; font-size: 13px; }
table.grid tr.clickable { cursor: pointer; }
table.grid tr.selected td { background: #f0f1fe; }
table.grid tr.detail td { background: #fafbfd; padding: 8px 24px 16px; }
table.grid tr.detail h4 { margin-top: 8px; }
table.grid td.empty { text-align: center; color: var(--muted); }

.status {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .03em;
    background: #eef0f4;
    color: var(--muted);
}
.status-active { background: var(--success-bg); color: var(--success-text); }
.status-expired, .status-disabled { background: #fdecec; color: #a12b2b; }

.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.dot-green { background: #4caf50; }
.dot-amber { background: #f5a623; }
.dot-red { background: var(--danger); }

.assign { display: flex; gap: 10px; align-items: center; margin-top: 12px; flex-wrap: wrap; }
.assign button.primary { background: var(--brand); color: #fff; padding: 7px 14px; }
.assign button.primary:hover { background: var(--brand-dark); }
.assign button.link { color: var(--brand); padding: 7px 8px; }

.pager { display: flex; justify-content: space-between; align-items: center; padding-top: 14px; }
.pager .page-sizes, .pager .pages { display: flex; align-items: center; gap: 6px; }
.pager .pages span { color: var(--muted); margin-right: 8px; }
button.pill { background: none; border: none; color: var(--text); border-radius: 999px; padding: 6px 14px; }
button.pill:hover { background: #f0f1fe; }
button.pill.active { background: var(--brand); color: #fff; }

.footnote { color: var(--muted); font-size: 13px; margin: 16px 0 0; }

.details-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.details-column > * { margin-bottom: 16px; }
@media (max-width: 1000px) { .details-layout { grid-template-columns: 1fr; } }
.card-title { font-size: 20px; font-weight: 400; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
dl.details { display: grid; grid-template-columns: 200px 1fr; row-gap: 6px; margin: 0; padding: 14px 0; border-bottom: 1px solid var(--border); }
dl.details dt { color: var(--text); }
dl.details dd { margin: 0; color: var(--muted); }
.strong, dl.details dd.strong { font-weight: 600; color: var(--text); }
table.compact th, table.compact td { padding: 6px 12px; }

.section-header .section-header-text { flex: 1; }
form.add-contact { padding: 16px 0; margin: 0; border-bottom: 1px solid var(--border); }
table.grid th.sortable { cursor: pointer; user-select: none; }
table.grid th.sortable:hover { color: var(--text); }
table.grid .key { width: 90px; }
.star { font-size: 20px; color: #9aa3b5; }
.star.on { color: #f5a623; }

.view-as-banner {
    display: flex;
    align-items: center;
    gap: 16px;
    background: #fff7e0;
    border: 1px solid #f5d98b;
    color: #7a5b00;
    border-radius: 8px;
    padding: 10px 16px;
    margin-bottom: 16px;
}
.view-as-banner span { flex: 1; }
a.button {
    display: inline-block;
    font-weight: 500;
    padding: 6px 14px;
    border-radius: 8px;
    border: 1px solid var(--brand);
    background: var(--brand);
    color: #fff;
}
a.button:hover { background: var(--brand-dark); text-decoration: none; }
form label.inline { flex-direction: row; align-items: center; gap: 8px; color: var(--text); padding-bottom: 8px; }

.help { max-width: 1000px; line-height: 1.6; }
.help ol { padding-left: 22px; margin: 0 0 12px; }
.help ul.bullets { list-style: disc; padding-left: 22px; margin: 0 0 12px; }
.help ul.bullets li { display: list-item; border: none; padding: 3px 0; }


.sidebar-footer form { display: block; margin: 0; }
.sidebar-footer .link-button { background: none; border: none; padding: 0; color: var(--sidebar-text); font: inherit; cursor: pointer; }
.sidebar-footer .link-button:hover { background: none; color: #fff; text-decoration: underline; }
