:root {
    --bg: #f4efe4;
    --bg-alt: #fffaf0;
    --ink: #1f2a2e;
    --muted: #58656b;
    --panel: rgba(255, 250, 240, 0.82);
    --line: rgba(31, 42, 46, 0.12);
    --accent: #0c7c73;
    --accent-2: #b85c38;
    --success: #1d7c54;
    --warning: #9b6a10;
    --danger: #9d2f2f;
    --shadow: 0 18px 48px rgba(24, 32, 35, 0.12);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    color: var(--ink);
    background:
        radial-gradient(circle at top left, rgba(184, 92, 56, 0.16), transparent 32%),
        radial-gradient(circle at top right, rgba(12, 124, 115, 0.18), transparent 28%),
        linear-gradient(180deg, #f8f3e8 0%, #efe6d6 100%);
    font-family: "Verdana Pro", Verdana, Arial, sans-serif;
    min-height: 100vh;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.page-shell {
    width: min(1200px, calc(100% - 2rem));
    margin: 0 auto;
    padding: 1.25rem 0 2rem;
}

.site-header,
.hero,
.actor-bar,
.panel,
.stat-grid .panel,
.thread,
.case-list,
.note-list,
.form-grid .panel {
    backdrop-filter: blur(10px);
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 22px;
    box-shadow: var(--shadow);
}

.site-header,
.actor-bar,
.hero {
    padding: 1.25rem 1.5rem;
    margin-bottom: 1rem;
}

.site-header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
}

.brand {
    display: inline-block;
    font-family: "Verdana Pro", Verdana, Arial, sans-serif;
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--ink);
}

.tagline,
.meta,
.hint,
.empty,
.case-pill small,
.thread-meta,
.note-meta {
    color: var(--muted);
}

.site-nav {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.site-nav a {
    padding: 0.55rem 0.95rem;
    border-radius: 999px;
    background: rgba(12, 124, 115, 0.09);
}

.hero h1,
.actor-bar h1,
.panel h2,
.thread h2,
.case-list h2,
.note-list h2 {
    margin: 0.2rem 0 0.3rem;
    font-family: "Verdana Pro", Verdana, Arial, sans-serif;
    line-height: 1.05;
}

.eyebrow {
    display: inline-block;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    font-size: 0.76rem;
    color: var(--accent-2);
}

.org-name-with-verification {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.org-name-label {
    font-weight: 700;
}

.org-domain-proof {
    display: inline-flex;
    align-items: center;
    color: var(--muted);
    font-size: 0.88em;
    font-weight: 500;
    letter-spacing: 0.01em;
}

.org-domain-proof::before {
    content: "·";
    color: var(--muted);
    margin-right: 0.45rem;
}

.verified-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.42rem;
    padding: 0.18rem 0.62rem 0.18rem 0.34rem;
    border-radius: 999px;
    border: 1px solid rgba(30, 64, 175, 0.42);
    background: linear-gradient(180deg, rgba(219, 234, 254, 0.95), rgba(191, 219, 254, 0.9));
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.75),
        0 1px 3px rgba(30, 64, 175, 0.18);
    color: #1e3a8a;
    font-size: 0.66rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    line-height: 1.1;
    text-transform: uppercase;
    white-space: nowrap;
}

.verified-tag-icon {
    position: relative;
    width: 1rem;
    height: 1rem;
    border-radius: 999px;
    background: radial-gradient(circle at 30% 30%, #93c5fd, #2563eb 72%);
    box-shadow:
        inset 0 -1px 1px rgba(30, 58, 138, 0.5),
        0 0 0 1px rgba(30, 64, 175, 0.28);
    flex: 0 0 auto;
}

.verified-tag-icon::before {
    content: "";
    position: absolute;
    inset: 2px;
    border-radius: 999px;
    border: 1px solid rgba(219, 234, 254, 0.62);
}

.verified-tag-icon::after {
    content: "";
    position: absolute;
    left: 0.31rem;
    top: 0.16rem;
    width: 0.26rem;
    height: 0.46rem;
    border-right: 2px solid #fff;
    border-bottom: 2px solid #fff;
    transform: rotate(42deg);
}

.verified-tag-text {
    display: inline-block;
    transform: translateY(0.01rem);
}

.alert {
    padding: 0.95rem 1.1rem;
    border-radius: 16px;
    margin-bottom: 1rem;
    border: 1px solid transparent;
}

.alert-info {
    background: rgba(12, 124, 115, 0.08);
    border-color: rgba(12, 124, 115, 0.18);
}

.alert-success {
    background: rgba(29, 124, 84, 0.08);
    border-color: rgba(29, 124, 84, 0.2);
}

.alert-warning {
    background: rgba(155, 106, 16, 0.08);
    border-color: rgba(155, 106, 16, 0.2);
}

.alert-error {
    background: rgba(157, 47, 47, 0.08);
    border-color: rgba(157, 47, 47, 0.2);
}

.status {
    min-height: 1.25rem;
    font-size: 0.92rem;
}

.status.ok {
    color: var(--success);
}

.status.err {
    color: var(--danger);
}

.strength-wrap {
    display: grid;
    gap: 0.45rem;
}

.strength-head {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    font-size: 0.92rem;
}

.strength-bar {
    width: 100%;
    height: 0.7rem;
    border-radius: 999px;
    background: rgba(31, 42, 46, 0.1);
    overflow: hidden;
}

.strength-fill {
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: #94a3b8;
    transition: width 140ms ease, background-color 140ms ease;
}

.stat-grid,
.form-grid,
.dashboard-grid {
    display: grid;
    gap: 1rem;
}

.stat-grid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    margin-bottom: 1rem;
}

.dashboard-grid {
    grid-template-columns: 320px minmax(0, 1fr);
    align-items: start;
}

.form-grid {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    margin-bottom: 1rem;
}

.panel,
.thread,
.case-list,
.note-list {
    padding: 1.15rem;
}

.panel h2,
.thread h2,
.case-list h2,
.note-list h2 {
    font-size: 1.35rem;
}

.panel p {
    margin-top: 0.35rem;
}

form {
    display: grid;
    gap: 0.85rem;
}

label {
    display: grid;
    gap: 0.35rem;
    font-weight: 700;
}

input,
select,
textarea,
button {
    font: inherit;
}

input,
select,
textarea {
    width: 100%;
    padding: 0.8rem 0.9rem;
    border-radius: 14px;
    border: 1px solid rgba(31, 42, 46, 0.18);
    background: rgba(255, 255, 255, 0.75);
    color: var(--ink);
}

textarea {
    min-height: 120px;
    resize: vertical;
}

button,
.button-link {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    padding: 0.85rem 1.15rem;
    border-radius: 999px;
    border: 0;
    background: linear-gradient(135deg, var(--accent), #115e59);
    color: #fff;
    font-weight: 700;
    cursor: pointer;
}

.button-link.alt,
button.alt {
    background: linear-gradient(135deg, var(--accent-2), #8e4528);
}

.lookup-results {
    margin-top: -0.2rem;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.68);
    max-height: 240px;
    overflow: auto;
}

.lookup-results:empty {
    display: none;
}

.lookup-result-item {
    width: 100%;
    text-align: left;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--ink);
    padding: 0.6rem 0.75rem;
    font-weight: 600;
    cursor: pointer;
}

.lookup-result-item:hover {
    background: rgba(12, 124, 115, 0.12);
}

.lookup-result-empty {
    padding: 0.6rem 0.75rem;
    color: var(--muted);
    font-size: 0.9rem;
}

.hint.err {
    color: var(--danger);
    font-weight: 700;
}

.situation-status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    border: 1px solid rgba(31, 42, 46, 0.2);
    background: rgba(12, 124, 115, 0.1);
    font-size: 0.73rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: lowercase;
}

.situation-particulars-panel {
    margin: 1rem 0;
}

.list-reset {
    list-style: none;
    margin: 0;
    padding: 0;
}

.radio-domain-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.65rem;
}

.radio-domain-option {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.65rem;
    align-items: start;
    padding: 0.75rem 0.8rem;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.62);
}

.radio-domain-option input[type="radio"] {
    width: auto;
    margin-top: 0.15rem;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
}

.radio-domain-name {
    font-weight: 700;
    line-height: 1.25;
}

.radio-domain-meta {
    color: var(--muted);
    font-size: 0.86rem;
    margin-top: 0.2rem;
}

.case-link,
.note-item,
.messidge {
    border-top: 1px solid var(--line);
    padding: 0.9rem 0;
}

.case-link:first-child,
.note-item:first-child,
.messidge:first-child {
    border-top: 0;
    padding-top: 0;
}

.case-link a {
    display: block;
    color: inherit;
}

.case-link.active a {
    padding: 0.8rem;
    border-radius: 16px;
    background: rgba(12, 124, 115, 0.09);
}

.case-pill {
    display: flex;
    justify-content: space-between;
    gap: 0.8rem;
}

.case-pill strong {
    display: block;
}

.thread {
    min-height: 420px;
}

.thread-body {
    display: grid;
    gap: 0.7rem;
    margin: 1rem 0 1.2rem;
}

.messidge {
    padding: 0.95rem 1rem;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.66);
}

.messidge.agent {
    border-left: 4px solid var(--accent);
}

.messidge.mark {
    border-left: 4px solid var(--accent-2);
}

.messidge.note {
    border-left: 4px solid #7c5c16;
    background: rgba(255, 248, 220, 0.72);
}

.messidge.note-linked {
    border-left-color: #8e4528;
    background:
        linear-gradient(135deg, rgba(184, 92, 56, 0.12), rgba(255, 248, 220, 0.82)),
        rgba(255, 248, 220, 0.72);
}

.messidge.note-general {
    border-left-color: #7c5c16;
    background:
        linear-gradient(135deg, rgba(124, 92, 22, 0.1), rgba(255, 248, 220, 0.78)),
        rgba(255, 248, 220, 0.72);
}

.messidge p,
.note-item p {
    margin: 0.45rem 0 0;
    line-height: 1.55;
    white-space: pre-wrap;
}

.messidge.note p,
.messidge-quote-body,
textarea[name="message_body"],
textarea[name="note_body"] {
    font-family: Consolas, "Courier New", monospace;
}

.messidge-quote {
    margin-top: 0.6rem;
    padding: 0.7rem 0.85rem;
    border: 1px solid rgba(31, 42, 46, 0.12);
    border-left: 3px solid rgba(12, 124, 115, 0.44);
    border-radius: 14px;
    background: rgba(255, 250, 240, 0.82);
}

.messidge-quote-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem 0.85rem;
    align-items: baseline;
    margin-bottom: 0.35rem;
    color: var(--muted);
    font-size: 0.84rem;
}

.messidge-quote-meta strong {
    color: var(--ink);
    font-size: 0.78rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.messidge-quote-body {
    line-height: 1.48;
    white-space: pre-wrap;
}

.inline-note-panel {
    margin-top: 1rem;
}

.split {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: baseline;
}

.inline-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.mark-body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    background:
        radial-gradient(circle at top left, rgba(12, 124, 115, 0.14), transparent 26%),
        linear-gradient(180deg, #f4f1ea 0%, #ece6db 100%);
    font-family: "Verdana Pro", Verdana, Arial, sans-serif;
}

.mark-shell {
    width: min(1160px, calc(100% - 1.5rem));
    margin: 0 auto;
    padding: 1.4rem 0 2.2rem;
}

.mark-header,
.mark-panel,
.mark-sidebar {
    backdrop-filter: blur(10px);
    background: rgba(255, 250, 240, 0.88);
    border: 1px solid var(--line);
    border-radius: 22px;
    box-shadow: var(--shadow);
}

.mark-header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
    padding: 1.1rem 1.25rem;
    margin-bottom: 1rem;
}

.mark-header-actions {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.mark-header h1,
.mark-panel h1,
.mark-panel h2,
.mark-sidebar h2 {
    margin: 0.2rem 0 0.25rem;
    font-family: "Verdana Pro", Verdana, Arial, sans-serif;
    line-height: 1.05;
}

.mark-auth {
    display: grid;
    gap: 1rem;
}

.mark-auth-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.mark-auth-grid.single {
    grid-template-columns: minmax(0, 560px);
    justify-content: center;
}

.mark-hero-card {
    padding: 1.35rem 1.4rem;
}

.mark-reminder {
    margin-top: 0.2rem;
    display: grid;
    justify-content: center;
}

.mark-reminder-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--muted);
    cursor: pointer;
    font-size: 0.9rem;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.mark-reminder-toggle:hover {
    color: var(--accent);
}

.mark-reminder-panel {
    margin-top: 0.7rem;
    width: min(560px, 100%);
}

.mark-layout {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 1rem;
    align-items: start;
}

.mark-sidebar,
.mark-panel {
    padding: 1.2rem;
}

.mark-sidebar {
    position: sticky;
    top: 1rem;
}

.mark-summary-card,
.mark-composer {
    padding: 1rem 1.05rem;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.58);
}

.mark-summary-card {
    margin-bottom: 1rem;
}

.mark-composer {
    margin-top: 1rem;
}

.mark-link {
    border-top: 1px solid var(--line);
}

.mark-link:first-child {
    border-top: 0;
}

.mark-link a {
    display: grid;
    gap: 0.2rem;
    padding: 0.8rem 0;
    color: inherit;
}

.mark-link.active a {
    padding: 0.85rem;
    border-radius: 16px;
    background: rgba(12, 124, 115, 0.1);
}

.mark-link small {
    color: var(--muted);
}

.mark-form {
    margin-top: 1rem;
}

@media (max-width: 900px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .site-header {
        flex-direction: column;
    }

    .site-nav {
        justify-content: flex-start;
    }

    .mark-layout {
        grid-template-columns: 1fr;
    }

    .mark-auth-grid {
        grid-template-columns: 1fr;
    }

    .mark-header {
        flex-direction: column;
    }

    .mark-header-actions {
        justify-content: flex-start;
    }

    .mark-sidebar {
        position: static;
    }
}
