:root {
    --mt-ink: #0f1b22;
    --mt-slate: #14303a;
    --mt-teal: #1b8a8a;
    --mt-teal-bright: #25b3ad;
    --mt-mist: #eef4f4;
    --mt-paper: #f7fafa;
    --mt-line: #d8e3e3;
    --mt-amber: #d9842b;
    --mt-danger: #c0392b;
    --mt-shadow: 0 1px 2px rgba(15,27,34,.06), 0 8px 24px -12px rgba(15,27,34,.18);
}

* { -webkit-font-smoothing: antialiased; }

body {
    font-family: 'Outfit', system-ui, sans-serif;
    background:
        radial-gradient(1200px 400px at 100% -10%, rgba(37,179,173,.07), transparent 60%),
        var(--mt-paper);
    color: var(--mt-ink);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

h1, h2, h3, .mt-display {
    font-family: 'Fraunces', Georgia, serif;
    letter-spacing: -.01em;
}

/* ---- Navbar ---- */
.mt-nav {
    background: rgba(20, 48, 58, .96);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid rgba(255,255,255,.06);
}
.mt-nav .navbar-brand, .mt-nav .nav-link { color: #cfe2e2; }
.mt-nav .nav-link:hover { color: #fff; }
.mt-nav .nav-link.active { color: #fff; }
.mt-logo {
    display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; border-radius: 9px;
    background: linear-gradient(135deg, var(--mt-teal-bright), var(--mt-teal));
    color: #fff; font-size: 1.05rem;
}
.mt-wordmark { font-family: 'Fraunces', serif; font-weight: 600; font-size: 1.2rem; color: #fff; }
.mt-wordmark-accent { color: var(--mt-teal-bright); font-weight: 500; margin-left: 1px; }

.mt-userbtn { color: #cfe2e2; border: 1px solid rgba(255,255,255,.12); border-radius: 999px; padding: .3rem .7rem; }
.mt-userbtn:hover { color: #fff; background: rgba(255,255,255,.06); }
.mt-avatar {
    display: inline-flex; align-items: center; justify-content: center;
    width: 26px; height: 26px; border-radius: 50%;
    background: var(--mt-teal); color: #fff; font-size: .8rem; font-weight: 600;
}
.mt-rolebadge { background: rgba(37,179,173,.18); color: var(--mt-teal-bright); font-weight: 500; }
.mt-dropdown { border: 1px solid var(--mt-line); box-shadow: var(--mt-shadow); border-radius: 12px; }

/* ---- Main ---- */
.mt-main { flex: 1 0 auto; max-width: 1320px; width: 100%; margin: 0 auto; }
.mt-footer { color: #6b8080; }

.mt-pagehead { margin-bottom: 1.5rem; }
.mt-pagehead h1 { font-size: 1.9rem; margin: 0; }
.mt-pagehead .mt-sub { color: #5f7575; margin-top: .15rem; }

/* ---- Cards ---- */
.mt-card {
    background: #fff; border: 1px solid var(--mt-line);
    border-radius: 16px; box-shadow: var(--mt-shadow);
}
.mt-card .card-body { padding: 1.4rem; }

/* ---- Study grid ---- */
.mt-study {
    background: #fff; border: 1px solid var(--mt-line); border-radius: 14px;
    overflow: hidden; transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
    height: 100%; display: flex; flex-direction: column;
}
.mt-study:hover { transform: translateY(-3px); box-shadow: var(--mt-shadow); border-color: var(--mt-teal-bright); }
.mt-study-banner {
    height: 84px; background: linear-gradient(120deg, var(--mt-slate), #1d4350);
    position: relative; display: flex; align-items: center; padding: 0 1.1rem;
}
.mt-study-banner .bi { color: rgba(255,255,255,.85); font-size: 1.5rem; }
.mt-study-mod {
    position: absolute; top: 12px; right: 12px;
    background: rgba(255,255,255,.15); color: #fff; font-size: .7rem; font-weight: 600;
    padding: .2rem .55rem; border-radius: 6px; letter-spacing: .04em;
}
.mt-study-body { padding: 1.1rem; flex: 1; }
.mt-study-title { font-weight: 600; font-size: 1.02rem; margin-bottom: .2rem; }
.mt-study-meta { color: #6b8080; font-size: .82rem; }
.mt-study-foot { padding: .8rem 1.1rem; border-top: 1px solid var(--mt-mist); display: flex; justify-content: space-between; align-items: center; }

/* ---- Buttons ---- */
.btn-mt {
    background: var(--mt-teal); color: #fff; border: none; border-radius: 9px;
    font-weight: 500; padding: .5rem 1.1rem;
}
.btn-mt:hover { background: var(--mt-slate); color: #fff; }
.btn-mt-outline {
    background: transparent; color: var(--mt-teal); border: 1px solid var(--mt-teal);
    border-radius: 9px; font-weight: 500; padding: .45rem 1rem;
}
.btn-mt-outline:hover { background: var(--mt-teal); color: #fff; }

/* ---- Tables ---- */
.mt-table { background: #fff; border-radius: 14px; overflow: hidden; border: 1px solid var(--mt-line); }
.mt-table table { margin: 0; }
.mt-table thead th { background: var(--mt-mist); color: var(--mt-slate); font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; border: 0; padding: .85rem 1rem; }
.mt-table tbody td { padding: .8rem 1rem; vertical-align: middle; border-color: var(--mt-mist); }

.mt-pill { font-size: .72rem; font-weight: 600; padding: .25rem .6rem; border-radius: 999px; }
.mt-pill-active { background: #e3f5ee; color: #1a7a52; }
.mt-pill-inactive { background: #fbe9e7; color: var(--mt-danger); }
.mt-pill-admin { background: #e8eef6; color: #2a4d7a; }
.mt-pill-client { background: var(--mt-mist); color: var(--mt-slate); }
.mt-pill-self { background: rgba(37,179,173,.16); color: var(--mt-teal); }

/* Pinned current-user (non-deletable) row */
.mt-row-self > td { background: rgba(37,179,173,.05); }
.mt-row-self > td:first-child { box-shadow: inset 3px 0 0 var(--mt-teal); }

/* ---- Auth ---- */
.mt-auth-wrap { min-height: 78vh; display: flex; align-items: center; justify-content: center; }
.mt-auth-card { width: 100%; max-width: 420px; }
.mt-auth-brand { text-align: center; margin-bottom: 1.6rem; }
.mt-auth-brand .mt-logo { width: 48px; height: 48px; font-size: 1.5rem; margin: 0 auto .6rem; }
.mt-auth-brand h1 { font-size: 1.5rem; }

.form-control:focus { border-color: var(--mt-teal-bright); box-shadow: 0 0 0 .2rem rgba(37,179,173,.15); }
.form-label { font-weight: 500; font-size: .88rem; color: var(--mt-slate); }

/* ---- Viewer ---- */
.mt-viewer-frame { width: 100%; height: calc(100vh - 230px); min-height: 480px; border: 1px solid var(--mt-line); border-radius: 14px; background: #000; }

.mt-empty { text-align: center; padding: 4rem 1rem; color: #6b8080; }
.mt-empty .bi { font-size: 3rem; color: var(--mt-line); }
