/* Smart Technologies Global admin.
   Layout follows the Jussi Institutes admin: top bar, collapsible sidebar, panels and tables.
   Colours are the STG palette: Bright Teal Blue, Yellow Orange, Cloud White, Text Charcoal. */
:root {
    --ink: #273746; --soft: #5d6d7c; --line: #dde5ec; --bg: #F4F7FA; --surface: #fff;
    --brand: #0f7896; --brand-tint: #e2f2f8; --teal: #159BC5; --orange: #FA9B17;
    --danger: #b42318; --ok: #157347;
    --radius: 10px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; font-family: "Manrope", system-ui, sans-serif; font-size: 15px; line-height: 1.5; color: var(--ink); background: var(--bg); }
a { color: var(--brand); }
h1 { font-size: 1.5rem; margin: 0; }
h2 { font-size: 1.1rem; margin: 0 0 .75rem; }
.muted { color: var(--soft); }
:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; }

/* Top bar + shell */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 1rem; height: 57px; padding: 0 1rem; background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar__brand { display: flex; align-items: center; gap: .6rem; font-weight: 700; color: var(--ink); text-decoration: none; }
.topbar__brand img { height: 34px; width: auto; }
.topbar__brand span { font-size: .8rem; font-weight: 700; color: var(--soft); padding-left: .6rem; border-left: 1px solid var(--line); }
.topbar__right { margin-left: auto; display: flex; align-items: center; gap: 1rem; font-size: .9rem; }
.topbar__right form { margin: 0; }
.topbar__menu { display: none; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; font-size: 1.2rem; padding: .2rem .6rem; cursor: pointer; color: var(--ink); }
.linkbtn { background: none; border: 0; padding: 0; color: var(--brand); font: inherit; cursor: pointer; text-decoration: underline; }
.shell { display: grid; grid-template-columns: 256px 1fr; min-height: calc(100vh - 57px); }

/* Sidebar: scrolling menu on top, signed-in user pinned to the bottom. */
.sidebar { position: sticky; top: 57px; height: calc(100vh - 57px); display: flex; flex-direction: column; background: var(--surface); border-right: 1px solid var(--line); }
.sidebar__nav { flex: 1; overflow-y: auto; padding: .5rem .75rem 1rem; }
.sidebar__section { margin-top: .5rem; }
.sidebar__group { display: flex; align-items: center; justify-content: space-between; padding: .45rem .6rem; border-radius: 8px; font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--soft); cursor: pointer; list-style: none; user-select: none; }
.sidebar__group::-webkit-details-marker { display: none; }
.sidebar__group::after { content: ""; width: .45rem; height: .45rem; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); margin-top: -.2rem; transition: transform .15s; }
.sidebar__section:not([open]) > .sidebar__group::after { transform: rotate(-45deg); margin-top: 0; }
.sidebar__group:hover { background: var(--bg); color: var(--ink); }
.sidebar ul { list-style: none; margin: 0 0 .25rem; padding: 0; }
.sidebar__nav a { display: block; padding: .4rem .6rem; border-radius: 8px; color: var(--ink); text-decoration: none; font-weight: 600; font-size: .92rem; }
.sidebar__nav a:hover { background: var(--bg); }
.sidebar__nav a[aria-current="page"] { background: var(--brand-tint); color: var(--brand); }
.sidebar__user { display: flex; align-items: center; gap: .35rem; padding: .6rem .6rem .6rem .5rem; border-top: 1px solid var(--line); background: var(--surface); }
.sidebar__user form { margin: 0; }
.user { flex: 1; min-width: 0; display: flex; align-items: center; gap: .6rem; padding: .35rem; border-radius: 10px; color: var(--ink); text-decoration: none; }
.user:hover { background: var(--bg); }
.user__badge { flex: none; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: var(--brand); color: #fff; font-weight: 700; font-size: 1rem; }
.user__text { min-width: 0; display: grid; line-height: 1.25; }
.user__name { font-weight: 700; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user__email { font-size: .76rem; color: var(--soft); overflow-wrap: break-word; }
.user__signout { flex: none; display: grid; place-items: center; width: 36px; height: 36px; border: 1px solid var(--line); background: var(--surface); border-radius: 50%; color: var(--soft); cursor: pointer; }
.user__signout:hover { border-color: var(--danger); color: var(--danger); }
.user__signout svg, .pw__toggle svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.main { padding: 1.5rem; max-width: 1200px; width: 100%; min-width: 0; }
@media (max-width: 860px) {
    .topbar__menu { display: block; }
    .topbar__brand span { display: none; }
    .shell { grid-template-columns: 1fr; }
    .sidebar { display: none; position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
    .sidebar.is-open { display: flex; }
    .main { padding: 1rem; }
}

/* Building blocks */
.pagehead { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; }
.pagehead__actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1rem; }
.panel__head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.empty { color: var(--soft); }
.grid2 { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 960px) { .grid2 { grid-template-columns: 1.3fr 1fr; align-items: start; } }

.btn { display: inline-flex; align-items: center; gap: .4rem; padding: .5rem .95rem; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); font: inherit; font-weight: 700; font-size: .9rem; text-decoration: none; cursor: pointer; }
.btn:hover { border-color: var(--soft); color: var(--ink); }
.btn--primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn--primary:hover { background: #0b5f78; border-color: #0b5f78; color: #fff; }
.btn--danger { background: #fff; border-color: var(--danger); color: var(--danger); }
.btn--danger:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn--pill { border: 1.5px solid var(--brand); border-radius: 999px; padding: .35rem 1rem; color: var(--brand); background: transparent; }
.btn--pill:hover { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn--small { padding: .25rem .65rem; font-size: .82rem; }

.flash { padding: .7rem 1rem; border-radius: 8px; margin-bottom: 1rem; font-weight: 600; }
.flash--success { background: #e7f5ec; color: var(--ok); }
.flash--error { background: #fdecea; color: var(--danger); }
.alert { padding: .7rem 1rem; border-radius: 8px; background: #fdecea; color: var(--danger); font-weight: 600; margin-bottom: 1rem; text-align: left; }

/* Tables */
.filters { display: flex; flex-wrap: wrap; align-items: end; gap: .75rem; margin-bottom: 1rem; }
.filters label { display: grid; gap: .2rem; font-size: .8rem; font-weight: 700; color: var(--soft); }
.filters select, .filters input { min-width: 160px; width: auto; }
.tablewrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th, .table td { text-align: left; padding: .6rem .8rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { font-size: .75rem; letter-spacing: .05em; text-transform: uppercase; color: var(--soft); background: #fafbfc; }
.table tr:last-child td { border-bottom: 0; }
.table tr.is-new td { background: #fffbf0; font-weight: 600; }
.table td small { display: block; font-weight: 400; color: var(--soft); }
.table__edit { text-align: right; width: 1%; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.tag { display: inline-block; padding: .1rem .55rem; border-radius: 999px; background: #eef1f4; color: var(--soft); font-size: .78rem; font-weight: 700; white-space: nowrap; }
.tag--status-new { background: #fff3cf; color: #7a5a00; }
.tag--status-in_progress { background: #e2f2f8; color: #0b5f78; }
.tag--status-closed { background: #eef1f4; color: var(--soft); }
.pager { display: flex; gap: 1.25rem; align-items: center; justify-content: center; margin-top: 1rem; color: var(--soft); }

/* Forms */
.form { display: grid; gap: 1rem; }
.field { display: grid; gap: .3rem; text-align: left; }
.field > label, .field__label { font-weight: 700; font-size: .9rem; }
.field--check label { display: flex; align-items: flex-start; gap: .5rem; font-weight: 600; }
.field--check input { margin-top: .25rem; }
.req { color: var(--danger); }
input[type="text"], input[type="email"], input[type="password"], input[type="search"], select, textarea {
    width: 100%; padding: .55rem .7rem; font: inherit; color: var(--ink); background: #fff; border: 1px solid #c3ced8; border-radius: 8px;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 3px solid var(--brand-tint); border-color: var(--brand); }
.help { margin: 0; font-size: .82rem; color: var(--soft); }
.form__actions { display: flex; gap: .5rem; flex-wrap: wrap; padding-top: .5rem; }
.danger-zone { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px dashed var(--line); }

/* Dashboard, details */
.cards { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); margin-bottom: 1rem; }
.card { display: grid; gap: .2rem; padding: 1.1rem 1.25rem; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--brand); border-radius: var(--radius); color: var(--ink); text-decoration: none; }
a.card:hover { border-color: var(--brand); }
.card--new { border-left-color: var(--orange); }
.card__num { font-size: 2rem; font-weight: 700; line-height: 1; }
.card__label { color: var(--soft); font-weight: 600; font-size: .9rem; }
.quick { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0; }
.details { display: grid; grid-template-columns: 120px 1fr; gap: .45rem 1rem; margin: 0 0 1rem; }
.details dt { color: var(--soft); font-weight: 600; }
.details dd { margin: 0; overflow-wrap: anywhere; }
.message-box { background: var(--bg); padding: .8rem 1rem; border-radius: 8px; overflow-wrap: anywhere; }
.note { border-left: 4px solid var(--line); padding: .1rem 0 .1rem .9rem; margin-bottom: 1rem; }
.note p { margin: 0 0 .2rem; overflow-wrap: anywhere; }
.note small { color: var(--soft); }

/* Sign in and setup */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: min(400px, 100%); justify-content: center; align-content: center; padding: 1rem; }
.login-wrap--wide { grid-template-columns: min(460px, 100%); }
.login { width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 2rem; text-align: center; }
.login__logo { height: 52px; width: auto; margin: 0 auto; }
.login h1 { margin: 1.25rem 0 .25rem; }
.login .form { text-align: left; margin-top: 1.25rem; }
.login .btn { justify-content: center; width: 100%; padding: .65rem 1rem; }
.login p { margin: 0; }

/* Password field with a show/hide button (the button appears when JavaScript runs). */
.pw { position: relative; }
.pw input { padding-right: 2.9rem; }
.pw__toggle { position: absolute; top: 0; right: 0; bottom: 0; width: 2.9rem; display: grid; place-items: center; border: 0; background: none; color: var(--soft); cursor: pointer; border-radius: 0 8px 8px 0; }
.pw__toggle[hidden] { display: none; }
.pw__toggle:hover { color: var(--ink); }
.pw__eye-off { display: none; }
.pw__toggle[aria-pressed="true"] .pw__eye { display: none; }
.pw__toggle[aria-pressed="true"] .pw__eye-off { display: block; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
