/* HN Group Staff Portal — colours taken from the HN Group logo stripes */
:root {
    --pink: #e97de8;
    --purple: #5514b4;
    --yellow: #e3e65b;
    --teal: #3e9ba3;
    --plum: #7a1f6c;
    --raspberry: #c2306b;
    --green: #5fae7b;
    --navy: #1c2135;

    --primary: var(--purple);
    --primary-hover: #460f96;
    --primary-tint: #f3eefb;
    --bg: #f5f6f9;
    --surface: #ffffff;
    --surface-2: #f8f9fb;
    --text: #1a1a1a;
    --text-muted: #5f6577;
    --border: #e3e5ec;
    --border-strong: #cfd3de;
    --radius: 12px;
    --shadow: 0 1px 2px rgba(28, 33, 53, 0.05), 0 4px 16px rgba(28, 33, 53, 0.06);
    --shadow-pop: 0 2px 6px rgba(28, 33, 53, 0.06), 0 16px 40px rgba(28, 33, 53, 0.16);
    --topbar-h: 68px;
    --stripe: linear-gradient(90deg,
        var(--pink) 0 14%, var(--purple) 14% 26%, var(--yellow) 26% 31%,
        var(--teal) 31% 49%, var(--plum) 49% 57%, var(--raspberry) 57% 66%,
        var(--green) 66% 78%, var(--navy) 78% 100%);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
body.modal-open { overflow: hidden; }
body.app-loading .topbar > *:not(.brand), body.app-loading .footer { visibility: hidden; }

h1 { font-size: 1.9rem; line-height: 1.2; letter-spacing: -0.02em; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1rem; }
a { color: var(--purple); }
.muted { color: var(--text-muted); }
.small { font-size: 0.85rem; }
.center { text-align: center; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

.icon { width: 18px; height: 18px; flex-shrink: 0; }
.icon.big { width: 44px; height: 44px; color: var(--text-muted); }

/* ---------- Brand ---------- */
.brand {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    text-decoration: none;
    color: inherit;
    flex-shrink: 0;
}
.brand-logo { height: 38px; width: auto; display: block; }
.brand-sub {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-muted);
    border-left: 1px solid var(--border);
    padding-left: 0.9rem;
    white-space: nowrap;
}
.brand-lg { flex-direction: column; gap: 0.6rem; margin-bottom: 1.75rem; }
.brand-lg .brand-logo { height: 72px; }
.brand-lg .brand-sub { border-left: 0; padding-left: 0; }

/* ---------- Forms & buttons ---------- */
label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin: 1rem 0 0.4rem;
}
.req { color: var(--raspberry); }
input[type="text"], input[type="password"], input[type="search"], input[type="tel"], select, textarea {
    width: 100%;
    padding: 0.65rem 0.85rem;
    font: inherit;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    transition: border-color 0.15s, box-shadow 0.15s;
}
select {
    appearance: none;
    padding-right: 2.2rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235f6577' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.7rem center;
    background-size: 16px;
}
textarea { resize: vertical; min-height: 120px; line-height: 1.5; }
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--purple);
    box-shadow: 0 0 0 3px rgba(85, 20, 180, 0.15);
}
input[readonly] { background: var(--surface-2); color: var(--text-muted); }

.password-field { position: relative; }
.password-field input { padding-right: 4.2rem; }
.toggle-pw {
    position: absolute;
    right: 0.4rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: 0;
    font: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--purple);
    padding: 0.35rem 0.5rem;
    cursor: pointer;
    border-radius: 6px;
}
.toggle-pw:hover { background: rgba(85, 20, 180, 0.08); }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.65rem 1.15rem;
    font: inherit;
    font-size: 0.925rem;
    font-weight: 600;
    border-radius: 8px;
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.15s, border-color 0.15s, opacity 0.15s;
    margin: 0;
}
.btn .icon { width: 16px; height: 16px; }
.btn:disabled { opacity: 0.6; cursor: default; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn-danger { background: var(--raspberry); color: #fff; }
.btn-danger:hover { background: #a82659; }
.btn-ghost { background: var(--surface); border-color: var(--border-strong); color: var(--text); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-dark { background: var(--navy); color: #fff; }
.btn-small { padding: 0.45rem 0.9rem; font-size: 0.85rem; }
.btn-block { width: 100%; margin-top: 1.5rem; }
.btn-block-sm { width: 100%; margin-top: 1rem; }
.btn-link {
    background: none;
    border: 0;
    padding: 0.3rem 0;
    color: var(--purple);
    font-weight: 600;
}
.btn-link:hover { text-decoration: underline; }
.btn-link.danger { color: var(--raspberry); }
.btn-row { display: flex; gap: 0.6rem; flex-wrap: wrap; }

.icon-btn {
    display: inline-grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid transparent;
    background: none;
    color: var(--text-muted);
    cursor: pointer;
}
.icon-btn:hover, .icon-btn[aria-expanded="true"] { background: var(--surface-2); border-color: var(--border); color: var(--text); }

.form-error, .form-success {
    margin-top: 1rem;
    padding: 0.65rem 0.85rem;
    border-radius: 8px;
    font-size: 0.875rem;
}
.form-error { background: #fdecf2; color: #9b1d4f; border: 1px solid #f6c4d6; }
.form-success { background: #e9f6ee; color: #23683d; border: 1px solid #bfe3cc; }
.hint { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.4rem; }
.hint-top { margin: 0 0 0.75rem; }
.form-actions { margin-top: 1.25rem; display: flex; justify-content: flex-end; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }

/* ---------- Login ---------- */
.login-page { justify-content: center; }
.login-page::before {
    content: "";
    position: fixed;
    inset: 0 0 auto 0;
    height: 6px;
    background: var(--stripe);
}
.login-wrap { width: 100%; max-width: 420px; margin: 0 auto; padding: 2rem 1rem; }
.login-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow);
    padding: 2.5rem 2rem 2rem;
}
.login-card h1 { font-size: 1.5rem; }
.login-card > .muted { margin-top: 0.25rem; font-size: 0.925rem; }
.login-foot { margin-top: 1.5rem; font-size: 0.85rem; text-align: center; }
.legal { margin-top: 1.25rem; font-size: 0.78rem; color: var(--text-muted); text-align: center; }

/* ---------- Top bar & navigation ---------- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    height: var(--topbar-h);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.75rem;
}
.topbar::after {
    content: "";
    position: absolute;
    left: 0; right: 0; bottom: -4px;
    height: 4px;
    background: var(--stripe);
    z-index: 1;
    pointer-events: none;
}
.mainnav { display: flex; align-items: center; gap: 0.25rem; height: 100%; flex: 1; }
.topbar-right { display: flex; align-items: center; gap: 0.5rem; height: 100%; margin-left: auto; }
.nav-item { position: relative; height: 100%; display: flex; align-items: center; }
.nav-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    height: 38px;
    padding: 0 0.8rem;
    border-radius: 8px;
    border: 0;
    background: none;
    font: inherit;
    font-size: 0.925rem;
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
}
.nav-link .icon { width: 17px; height: 17px; }
.nav-link .chev { width: 15px; height: 15px; transition: transform 0.15s; }
.nav-link:hover, .nav-link[aria-expanded="true"] { background: var(--surface-2); color: var(--text); }
.nav-link[aria-expanded="true"] .chev { transform: rotate(180deg); }
.nav-link.active { color: var(--purple); background: var(--primary-tint); }
.nav-toggle { display: none; }

/* Dropdown menus — open below the colour stripe and above everything else in the bar. */
.menu {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    z-index: 70;
    min-width: 300px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow-pop);
    padding: 0.4rem;
    animation: menu-in 0.12s ease-out;
}
.menu-right { left: auto; right: 0; }
@keyframes menu-in {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: none; }
}
.menu-item {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    width: 100%;
    padding: 0.6rem 0.7rem;
    border: 0;
    border-radius: 10px;
    background: none;
    font: inherit;
    text-align: left;
    color: var(--text);
    text-decoration: none;
    cursor: pointer;
}
.menu-item:hover, .menu-item:focus-visible { background: var(--primary-tint); outline: none; }
.mi-icon {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: var(--primary-tint);
    color: var(--purple);
    flex-shrink: 0;
}
.menu-item:hover .mi-icon { background: var(--purple); color: #fff; }
.mi-text { display: flex; flex-direction: column; min-width: 0; }
.mi-title { font-weight: 600; font-size: 0.925rem; display: flex; align-items: center; gap: 0.4rem; }
.mi-desc { font-size: 0.8rem; color: var(--text-muted); }
.soon {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0.05rem 0.4rem;
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--text-muted);
    border: 1px solid var(--border);
}
.menu-item.compact { padding: 0.55rem 0.75rem; gap: 0.7rem; font-size: 0.925rem; }
.menu-item.compact .icon { color: var(--text-muted); }
.menu-item.compact:hover .icon { color: var(--purple); }
.menu-item.danger, .menu-item.danger .icon { color: var(--raspberry); }
.menu-item.danger:hover { background: #fdecf2; }
.menu-item.danger:hover .icon { color: var(--raspberry); }
.menu-sep { height: 1px; background: var(--border); margin: 0.35rem 0.25rem; }
.menu-header { display: flex; align-items: center; gap: 0.75rem; padding: 0.6rem 0.7rem 0.5rem; }
.menu-header-text { min-width: 0; }
.mh-name { font-weight: 700; }
.mh-email { font-size: 0.8rem; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-user { min-width: 270px; }

.user-btn {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: none;
    border: 1px solid transparent;
    border-radius: 999px;
    padding: 0.25rem 0.6rem 0.25rem 0.25rem;
    font: inherit;
    color: inherit;
    cursor: pointer;
    text-align: left;
}
.user-btn:hover, .user-btn[aria-expanded="true"] { background: var(--surface-2); border-color: var(--border); }
.user-btn .chev { width: 15px; height: 15px; color: var(--text-muted); }
.user-meta { display: flex; flex-direction: column; line-height: 1.25; max-width: 200px; }
.user-name { font-weight: 600; font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 0.75rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* First sign-in: hide navigation until a password is set */
body.locked .mainnav, body.locked .topbar-right { display: none; }

/* ---------- Avatars ---------- */
.avatar {
    display: inline-grid;
    place-items: center;
    border-radius: 50%;
    color: #fff;
    font-weight: 700;
    flex-shrink: 0;
    object-fit: cover;
    background: var(--purple);
    line-height: 1;
}
.avatar-xs { width: 24px; height: 24px; font-size: 0.65rem; }
.avatar-sm { width: 34px; height: 34px; font-size: 0.8rem; }
.avatar-md { width: 42px; height: 42px; font-size: 0.95rem; }
.avatar-lg { width: 56px; height: 56px; font-size: 1.2rem; }
.avatar-xl { width: 96px; height: 96px; font-size: 2rem; }
.avatar-c0 { background: var(--purple); }
.avatar-c1 { background: var(--teal); }
.avatar-c2 { background: var(--raspberry); }
.avatar-c3 { background: var(--plum); }
.avatar-c4 { background: #3f8a5a; }
.avatar-c5 { background: var(--navy); }

/* ---------- Page layout ---------- */
.container {
    width: 100%;
    max-width: 1180px;
    margin: 0 auto;
    padding: 2rem 1.5rem 3rem;
    flex: 1;
    outline: none;
}
.loading, .empty { padding: 3rem 1rem; text-align: center; color: var(--text-muted); }
.empty-page { text-align: center; padding: 4rem 1rem; display: flex; flex-direction: column; align-items: center; gap: 0.75rem; }

.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}
.page-head .muted { margin-top: 0.3rem; }
.page-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; }

.banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.9rem 1.1rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}
.banner-warn { background: #fbfbe3; border: 1px solid var(--yellow); }

.hero { margin: 0.25rem 0 1.5rem; }
.eyebrow {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--purple);
    margin-bottom: 0.35rem;
}
.hero .muted { margin-top: 0.35rem; }

/* Clocks */
.clocks { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 2.25rem; }
.clock-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem 1.4rem;
    box-shadow: 0 1px 2px rgba(28, 33, 53, 0.04);
    position: relative;
    overflow: hidden;
}
.clock-card::before {
    content: "";
    position: absolute;
    left: 0; top: 0; right: 0;
    height: 3px;
    background: var(--purple);
}
.clock-card-alt::before { background: var(--teal); }
.clock-head { display: flex; align-items: center; gap: 0.75rem; }
.clock-icon {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: var(--primary-tint);
    color: var(--purple);
}
.clock-card-alt .clock-icon { background: #e7f4f5; color: var(--teal); }
.clock-label { font-weight: 700; }
.clock-sub { font-size: 0.8rem; color: var(--text-muted); }
.clock-time {
    font-size: 2.6rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
    margin-top: 0.75rem;
    line-height: 1.1;
}
.clock-date { color: var(--text-muted); margin-top: 0.2rem; }
.clock-note {
    margin-top: 0.75rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    padding-top: 0.6rem;
    border-top: 1px dashed var(--border);
}

.layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 2rem;
    align-items: start;
}
.section-title {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 0.9rem;
}

.tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
}
.tile {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    padding: 1.25rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-decoration: none;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(28, 33, 53, 0.04);
    transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
    overflow: hidden;
}
.tile::before {
    content: "";
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 4px;
    background: var(--accent, var(--purple));
}
.tile-c0 { --accent: var(--purple); }
.tile-c1 { --accent: var(--teal); }
.tile-c2 { --accent: var(--pink); }
.tile-c3 { --accent: var(--raspberry); }
.tile-c4 { --accent: var(--green); }
.tile-c5 { --accent: var(--plum); }
.tile:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: #d4d7e2; }
.tile-icon { color: var(--accent); margin-bottom: 0.4rem; }
.tile-icon .icon { width: 24px; height: 24px; }
.tile-title { font-weight: 700; }
.tile-desc { font-size: 0.875rem; color: var(--text-muted); }

.tag, .badge {
    display: inline-block;
    align-self: flex-start;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.12rem 0.55rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text-muted);
    white-space: nowrap;
}
.tag { margin-top: 0.5rem; }
.tag-live { background: var(--primary-tint); color: var(--purple); border-color: #ddd0f3; }
.badge-grey { }
.badge-green { background: #e9f6ee; color: #23683d; border-color: #bfe3cc; }
.badge-yellow { background: #fbfbe3; color: #6b6a12; border-color: #e6e79a; }
.badge-red { background: #fdecf2; color: #9b1d4f; border-color: #f6c4d6; }

.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
}
.side-col .panel + .panel { margin-top: 1rem; }
.panel .muted { font-size: 0.9rem; }
.panel-title { font-size: 1.05rem; margin-bottom: 0.25rem; }
.news h3 { margin: 0 0 0.35rem; }
.me-card { display: flex; align-items: center; gap: 0.85rem; margin-bottom: 0.75rem; }
.me-name { font-weight: 700; }

.facts { display: grid; grid-template-columns: auto 1fr; gap: 0.45rem 1rem; font-size: 0.9rem; margin-top: 0.75rem; }
.facts dt { color: var(--text-muted); }
.facts dd { word-break: break-word; }

.footer { text-align: center; font-size: 0.8rem; padding: 1.5rem; border-top: 1px solid var(--border); }

/* ---------- Toolbar, directory ---------- */
.toolbar { display: flex; gap: 0.75rem; margin-bottom: 0.75rem; flex-wrap: wrap; }
.toolbar select { width: auto; min-width: 220px; }
.search { position: relative; flex: 1; min-width: 240px; margin: 0; font-weight: 400; }
.search .icon { position: absolute; left: 0.8rem; top: 50%; transform: translateY(-50%); color: var(--text-muted); width: 17px; height: 17px; }
.search input { padding-left: 2.4rem; }

.people-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1rem; margin-top: 0.75rem; }
.person-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.2rem;
    padding: 1.5rem 1rem 1.25rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font: inherit;
    color: inherit;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}
.person-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.person-card .avatar { margin-bottom: 0.6rem; }
.pc-name { font-weight: 700; }
.pc-title { font-size: 0.875rem; }
.pc-company { font-size: 0.8rem; color: var(--purple); font-weight: 600; }
.pc-meta { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.78rem; color: var(--text-muted); margin-top: 0.5rem; }
.pc-meta .icon { width: 13px; height: 13px; }

.profile-head { display: flex; align-items: center; gap: 1.25rem; padding-right: 2rem; }
.profile-body { margin-top: 1.5rem; }
.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.6rem; }
.chip { font-size: 0.78rem; font-weight: 600; padding: 0.15rem 0.6rem; border-radius: 999px; background: var(--primary-tint); color: var(--purple); }
.person-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.25rem 0.75rem 0.25rem 0.25rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    font: inherit;
    font-size: 0.875rem;
    cursor: pointer;
}
.person-chip:hover { border-color: var(--purple); }
.detail-row { display: flex; gap: 0.85rem; padding: 0.7rem 0; border-top: 1px solid var(--border); }
.detail-row > .icon { color: var(--text-muted); margin-top: 0.15rem; }
.detail-row a { text-decoration: none; }
.detail-row a:hover { text-decoration: underline; }
.detail-head { font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); margin-top: 1.25rem; }

/* ---------- Employee table ---------- */
.table-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.table th {
    text-align: left;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    padding: 0.8rem 1rem;
    border-bottom: 1px solid var(--border);
    background: var(--surface-2);
}
.table th:first-child { border-top-left-radius: var(--radius); }
.table th:last-child { border-top-right-radius: var(--radius); }
.table td { padding: 0.75rem 1rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #fbfbfd; }
.col-actions { width: 56px; text-align: right; }
.emp-cell { display: flex; align-items: center; gap: 0.75rem; }
.emp-name { font-weight: 600; }
.row-menu { height: auto; justify-content: flex-end; }
.row-menu .menu { top: calc(100% + 4px); min-width: 220px; }
.row-menu .menu.flip-up { top: auto; bottom: calc(100% + 4px); }

/* ---------- Modals ---------- */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(28, 33, 53, 0.5);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 6vh 1rem 2rem;
    overflow-y: auto;
    z-index: 100;
    animation: fade-in 0.12s ease-out;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.modal {
    position: relative;
    width: 100%;
    max-width: 460px;
    background: var(--surface);
    border-radius: 16px;
    padding: 1.75rem;
    box-shadow: 0 20px 50px rgba(28, 33, 53, 0.25);
}
.modal-wide { max-width: 720px; }
.modal-title { font-size: 1.3rem; padding-right: 2rem; }
.modal-title.center { padding: 0; }
.modal > .muted { margin-top: 0.3rem; }
.modal-close { position: absolute; top: 1rem; right: 1rem; }
.modal-actions { display: flex; justify-content: flex-end; gap: 0.6rem; margin-top: 1.5rem; flex-wrap: wrap; }
.sticky-actions {
    position: sticky;
    bottom: -1.75rem;
    background: var(--surface);
    margin: 1.5rem -1.75rem -1.75rem;
    padding: 1rem 1.75rem;
    border-top: 1px solid var(--border);
    border-radius: 0 0 16px 16px;
}

fieldset { border: 0; border-top: 1px solid var(--border); margin-top: 1.5rem; padding-top: 0.5rem; }
legend { font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--purple); padding-right: 0.75rem; }

.check-chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.check-chip { margin: 0; font-weight: 500; cursor: pointer; }
.check-chip input { position: absolute; opacity: 0; pointer-events: none; }
.check-chip span {
    display: inline-block;
    padding: 0.35rem 0.8rem;
    border-radius: 999px;
    border: 1px solid var(--border-strong);
    font-size: 0.85rem;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.check-chip input:checked + span { background: var(--primary-tint); border-color: var(--purple); color: var(--purple); font-weight: 600; }
.check-chip input:focus-visible + span { box-shadow: 0 0 0 3px rgba(85, 20, 180, 0.15); }
.check-chip.disabled { opacity: 0.4; cursor: default; }

.email-row { padding: 0.75rem; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); margin-bottom: 0.6rem; }
.email-input { display: flex; align-items: center; gap: 0.4rem; }
.email-input .email-local { flex: 1.2; min-width: 0; }
.email-input select { flex: 1; min-width: 0; }
.email-at { color: var(--text-muted); font-weight: 600; }
.email-opts { display: flex; align-items: center; gap: 1.1rem; flex-wrap: wrap; margin-top: 0.5rem; }
.email-opts .btn-link { margin-left: auto; font-size: 0.85rem; }
.inline-check { display: inline-flex; align-items: center; gap: 0.4rem; margin: 0; font-weight: 500; font-size: 0.85rem; cursor: pointer; }
.inline-check input { accent-color: var(--purple); width: 15px; height: 15px; }
.email-note { margin-top: 0.4rem; font-size: 0.8rem; color: #6b6a12; }

.success-mark {
    width: 56px;
    height: 56px;
    margin: 0.25rem auto 1rem;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--primary-tint);
    color: var(--purple);
}
.success-mark .icon { width: 26px; height: 26px; }
.cred-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.8rem 1rem;
    margin-top: 0.9rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-2);
}
.cred-label { font-size: 0.75rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.cred-value { font-weight: 600; font-size: 0.95rem; overflow-wrap: anywhere; }
.cred-value.big { font-size: 1.35rem; letter-spacing: 0.04em; }
.plain-list { list-style: none; margin-top: 0.5rem; font-size: 0.9rem; }
.plain-list li { padding: 0.35rem 0; border-bottom: 1px solid var(--border); }

/* ---------- Settings ---------- */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; align-items: start; }
.avatar-edit { display: flex; align-items: center; gap: 1.25rem; margin-top: 1rem; }
.avatar-edit label.btn { margin: 0; }
.settings-grid .facts { margin-top: 1rem; }
#password { scroll-margin-top: calc(var(--topbar-h) + 1.5rem); }

.force-wrap { display: flex; justify-content: center; padding: 2rem 0; }
.force-card {
    width: 100%;
    max-width: 440px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow);
    padding: 2rem;
}
.force-card h1 { font-size: 1.5rem; }
.force-card .btn-link { margin-top: 0.75rem; }

.toast {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--navy);
    color: #fff;
    padding: 0.7rem 1.1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    box-shadow: var(--shadow);
    z-index: 200;
    max-width: calc(100% - 2rem);
}

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
    .brand-sub { display: none; }
    .user-meta { display: none; }
    .topbar { gap: 1rem; }
}
@media (max-width: 900px) {
    .layout, .settings-grid { grid-template-columns: 1fr; }
    .nav-toggle { display: inline-grid; }
    .mainnav {
        display: none;
        position: absolute;
        top: calc(100% + 4px);
        left: 0;
        right: 0;
        height: auto;
        max-height: calc(100vh - var(--topbar-h));
        overflow-y: auto;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 0.5rem 1rem 1rem;
        background: var(--surface);
        border-bottom: 1px solid var(--border);
        box-shadow: var(--shadow-pop);
    }
    body.nav-open .mainnav { display: flex; }
    .mainnav .nav-item { height: auto; flex-direction: column; align-items: stretch; }
    .mainnav .nav-link { width: 100%; height: 46px; justify-content: flex-start; }
    .mainnav .nav-link .chev { margin-left: auto; }
    .mainnav .menu {
        position: static;
        box-shadow: none;
        border: 0;
        padding: 0 0 0.4rem 0.5rem;
        min-width: 0;
        animation: none;
    }
}
@media (max-width: 700px) {
    .clocks { grid-template-columns: 1fr; }
    .grid-2 { grid-template-columns: 1fr; }
    .table thead { display: none; }
    .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
    .table tr { position: relative; padding: 0.75rem 0; border-bottom: 1px solid var(--border); }
    .table tbody tr:last-child { border-bottom: 0; }
    .table td { border: 0; padding: 0.2rem 1rem; }
    .table td[data-label]::before { content: attr(data-label) ": "; color: var(--text-muted); font-size: 0.8rem; }
    .table td.col-actions { position: absolute; top: 0.75rem; right: 0; width: auto; }
    .table td:first-child { padding-right: 3rem; }
}
@media (max-width: 600px) {
    .topbar { padding: 0 1rem; }
    .brand-logo { height: 30px; }
    .container { padding: 1.5rem 1rem 2.5rem; }
    h1 { font-size: 1.5rem; }
    .clock-time { font-size: 2.1rem; }
    .banner { flex-direction: column; align-items: flex-start; }
    .login-card { padding: 2rem 1.25rem 1.5rem; }
    .modal { padding: 1.4rem; }
    .sticky-actions { margin: 1.5rem -1.4rem -1.4rem; padding: 1rem 1.4rem; bottom: -1.4rem; }
    .toolbar select { width: 100%; }
    .profile-head { flex-direction: column; align-items: flex-start; }
    .avatar-edit { flex-direction: column; align-items: flex-start; }
}

.count-pill {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0 0.4rem;
    border-radius: 999px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-muted);
    vertical-align: 1px;
}

/* ---------- Owner, roles ---------- */
.badge-owner { background: var(--navy); color: #fff; border-color: var(--navy); }
.role-list { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 0.6rem; }
.role-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    padding: 0.6rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-2);
}
.role-item.current { border-color: var(--purple); background: var(--primary-tint); }
.role-company { font-weight: 600; font-size: 0.9rem; }
.role-list.compact { margin: 0.75rem 0 0; }
.role-list.compact .role-item { padding: 0.5rem 0.7rem; }
.facts dd .role-list { margin-top: 0; }

.role-row { margin-top: 0.75rem; padding: 0.75rem 0.9rem 0.9rem; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.role-row-head { display: flex; align-items: center; gap: 0.5rem; font-weight: 700; font-size: 0.9rem; color: var(--purple); }
.role-row-head .icon { width: 16px; height: 16px; }
.role-row label { margin-top: 0.6rem; }

/* ---------- Directory views ---------- */
.segmented { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); }
.segmented button {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.85rem;
    border: 0;
    border-radius: 8px;
    background: none;
    font: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
}
.segmented button .icon { width: 16px; height: 16px; }
.segmented button:hover { color: var(--text); }
.segmented button.active { background: var(--purple); color: #fff; }

.company-tabs { display: flex; gap: 0.4rem; overflow-x: auto; padding-bottom: 0.25rem; margin-bottom: 0.9rem; scrollbar-width: thin; }
.company-tabs button {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.9rem;
    border-radius: 999px;
    border: 1px solid var(--border-strong);
    background: var(--surface);
    font: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
}
.company-tabs button:hover { color: var(--text); border-color: var(--text-muted); }
.company-tabs button.active { background: var(--primary-tint); border-color: var(--purple); color: var(--purple); }
.tab-count { font-size: 0.72rem; padding: 0 0.4rem; border-radius: 999px; background: var(--surface-2); color: var(--text-muted); }
.company-tabs button.active .tab-count { background: #fff; color: var(--purple); }

.pc-reports { font-size: 0.78rem; color: var(--text-muted); }
.table-click tbody tr { cursor: pointer; }
.table-click tbody tr:focus-visible td { background: var(--primary-tint); outline: none; }
.nowrap { white-space: nowrap; }

/* Org chart */
.org-hint { display: flex; align-items: center; gap: 0.4rem; margin-bottom: 0.6rem; }
.org-hint .icon { width: 15px; height: 15px; }
.org-scroll {
    overflow: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem 1rem 2rem;
    max-height: 75vh;
}
.org { width: max-content; min-width: 100%; margin: 0 auto; }
.org ul { display: flex; justify-content: center; padding-top: 22px; position: relative; list-style: none; }
.org li { position: relative; padding: 22px 8px 0; display: flex; flex-direction: column; align-items: center; }
.org li::before, .org li::after {
    content: "";
    position: absolute;
    top: 0;
    right: 50%;
    width: 50%;
    height: 22px;
    border-top: 2px solid var(--border-strong);
}
.org li::after { right: auto; left: 50%; border-left: 2px solid var(--border-strong); }
.org li:only-child::before, .org li:only-child::after { display: none; }
.org li:only-child { padding-top: 0; }
.org li:first-child::before, .org li:last-child::after { border: 0 none; }
.org li:last-child::before { border-right: 2px solid var(--border-strong); border-radius: 0 8px 0 0; }
.org li:first-child::after { border-radius: 8px 0 0 0; }
.org ul ul::before {
    content: "";
    position: absolute;
    top: 0;
    left: 50%;
    height: 22px;
    border-left: 2px solid var(--border-strong);
}
.org ul.org-roots { padding-top: 0; gap: 2rem; align-items: flex-start; }
.org ul.org-roots > li { padding-top: 0; }
.org ul.org-roots > li::before, .org ul.org-roots > li::after { display: none; }
.org-node { position: relative; display: flex; flex-direction: column; align-items: center; }
.org-card {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    width: 200px;
    padding: 0.6rem 0.7rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-top: 3px solid var(--purple);
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(28, 33, 53, 0.08);
    font: inherit;
    text-align: left;
    color: inherit;
    cursor: pointer;
    transition: box-shadow 0.15s, transform 0.15s;
}
.org-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.org-node.is-owner .org-card { border-top-color: var(--navy); }
.org-text { display: flex; flex-direction: column; min-width: 0; }
.org-name { font-weight: 700; font-size: 0.875rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.org-title { font-size: 0.78rem; color: var(--text-muted); line-height: 1.3; }
.org-company { font-size: 0.7rem; font-weight: 600; color: var(--purple); margin-top: 0.1rem; }
.org-toggle {
    position: relative;
    z-index: 1;
    margin-top: -10px;
    min-width: 26px;
    height: 20px;
    padding: 0 0.4rem;
    border-radius: 999px;
    border: 1px solid var(--border-strong);
    background: var(--surface);
    font: inherit;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
    cursor: pointer;
}
.org-toggle:hover { border-color: var(--purple); color: var(--purple); }
.org-node:has(.org-toggle) + ul { padding-top: 12px; }

/* ---------- Logged in as banner ---------- */
.imp-banner { background: var(--navy); color: #fff; }
.imp-inner {
    max-width: 1180px;
    margin: 0 auto;
    padding: 0.7rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9rem;
    margin-top: 4px;
}
.imp-inner span { flex: 1; }
.btn-light { background: #fff; color: var(--navy); }
.btn-light:hover { background: #eceef5; }

/* ---------- System panel ---------- */
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-bottom: 1.25rem; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.25rem; }
.stat-value { font-size: 1.8rem; font-weight: 700; letter-spacing: -0.02em; }
.stat-label { font-size: 0.85rem; color: var(--text-muted); }
.sys-section { margin-bottom: 1.25rem; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 0.9rem; }
.panel-title { display: flex; align-items: center; gap: 0.5rem; }
.panel-title .icon { color: var(--purple); }
.table-card.flat { border-radius: 10px; overflow-x: auto; }
.sys-search { display: block; margin: 0.75rem 0; }
.user-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 0.6rem; max-height: 420px; overflow-y: auto; }
.user-pick-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 10px;
}
.user-pick-row .emp-cell { min-width: 0; flex: 1; }
.user-pick-row .emp-cell > div { min-width: 0; }
.user-pick-row .muted.small, .user-pick-row .emp-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-pick-row > .btn, .user-pick-row > .muted { flex-shrink: 0; white-space: nowrap; }
.audit { list-style: none; max-height: 360px; overflow-y: auto; margin-top: 0.75rem; }
.audit li { padding: 0.55rem 0; border-bottom: 1px solid var(--border); font-size: 0.875rem; }
.audit li:last-child { border-bottom: 0; }
.pin-input {
    margin-top: 1.25rem;
    text-align: center;
    font-size: 1.8rem !important;
    letter-spacing: 0.6em;
    padding-left: 0.6em !important;
    font-variant-numeric: tabular-nums;
}

@media (max-width: 700px) {
    .stat-row { grid-template-columns: 1fr 1fr 1fr; gap: 0.5rem; }
    .stat { padding: 0.75rem; }
    .stat-value { font-size: 1.4rem; }
    .user-pick { grid-template-columns: 1fr; }
    .imp-inner { flex-wrap: wrap; padding: 0.7rem 1rem; }
    .page-head .segmented { width: 100%; }
    .segmented button { flex: 1; justify-content: center; }
}
