
:root {
    --green: #254735;
    --lime: #d8ef91;
    --background: #f5f7f2;
    --border: #e1e6dc;
    --muted: #73816e;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--background);
    color: #253629;
    font-family: Arial, sans-serif;
    font-size: 14px;
}

a {
    color: inherit;
    text-decoration: none;
}

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

h1 {
    margin: 8px 0;
    font-size: 30px;
}

h2 {
    margin: 0 0 16px;
    font-size: 19px;
}

h3 {
    margin: 0 0 9px;
    font-size: 16px;
}

p {
    line-height: 1.6;
}

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

.eyebrow {
    font-size: 11px;
    letter-spacing: 2px;
    color: var(--muted);
}

/* Navigation and page header */
.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 220px;
    background: white;
    border-right: 1px solid var(--border);
    padding: 28px 20px;
    overflow-y: auto;
}

.brand {
    display: block;
    font-size: 25px;
    font-weight: bold;
    margin-bottom: 32px;
}

.brand span {
    color: #84a858;
}

.sidebar nav {
    display: grid;
    gap: 8px;
}

.sidebar nav a {
    padding: 13px 14px;
    border-radius: 8px;
    color: #687765;
}

.sidebar nav a:hover {
    background: #eef3e6;
}

.sidebar nav a.active {
    background: var(--lime);
    color: var(--green);
    font-weight: bold;
}

.sidebar-note {
    margin-top: 28px;
    padding-top: 18px;
    border-top: 1px solid var(--border);
    line-height: 1.7;
    font-size: 12px;
}

.page {
    margin-left: 220px;
}

.topbar {
    background: white;
    padding: 22px 32px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.topbar a {
    font-size: 12px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 7px;
}

.mobile-menu {
    display: none;
}

main {
    max-width: 1440px;
    margin: auto;
    padding: 30px 32px;
}

.page-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-bottom: 25px;
}

.page-title p {
    margin: 9px 0 0;
    color: var(--muted);
}

.button {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    min-height: 44px;
    padding: 11px 17px;
    background: var(--green);
    color: white;
    border: 1px solid var(--green);
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    font-size: 13px;
}

.button.secondary {
    background: white;
    border-color: var(--border);
    color: var(--green);
}

.button:hover {
    opacity: .85;
}

.button-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.back-link {
    display: inline-block;
    margin-bottom: 20px;
    color: #637e51;
}

/* Cards and dashboard */
.stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 22px;
}

.stat,
.card {
    background: white;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 22px;
    min-width: 0;
}

.stat strong {
    display: block;
    font-size: 32px;
    margin: 17px 0 9px;
}

.stat small {
    font-size: 11px;
}

.grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 22px;
}

.cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
}

.stack {
    display: grid;
    gap: 18px;
    align-content: start;
}

.banner {
    padding: 21px 23px;
    border-radius: 12px;
    background: #e9f0da;
    margin-bottom: 22px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.banner h2 {
    margin-bottom: 8px;
    font-size: 17px;
}

.banner p {
    margin: 0;
    font-size: 12px;
    color: var(--muted);
}

.card-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
}

.card-heading h2 {
    margin: 0;
}

.card-heading a {
    font-size: 12px;
    color: #657c51;
}

.list-item {
    padding: 15px 0;
    border-bottom: 1px solid var(--border);
}

.list-item:last-child {
    border: 0;
}

.list-item p {
    margin: 6px 0;
    font-size: 12px;
    color: var(--muted);
}

.progress {
    height: 7px;
    background: #edf1e5;
    border-radius: 8px;
    margin: 19px 0 11px;
}

.progress span {
    display: block;
    height: 100%;
    background: #b1cc79;
    border-radius: 8px;
}

.badge {
    display: inline-block;
    padding: 5px 8px;
    font-size: 11px;
    color: #5f7b47;
    background: #edf3e5;
    border-radius: 5px;
}

.badge.blue {
    color: #5e7b9d;
    background: #edf3fa;
}

.badge.amber {
    color: #a08040;
    background: #fcf3e1;
}

.badge.red {
    color: #a3655b;
    background: #fbefeb;
}

.badge.gray {
    color: #7c8578;
    background: #f0f3ee;
}

.details {
    margin: 0;
}

.details div {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
}

.details dt {
    color: var(--muted);
}

.details dd {
    margin: 0;
    text-align: right;
    overflow-wrap: anywhere;
}

footer {
    color: var(--muted);
    font-size: 11px;
    padding: 26px 0 5px;
}

/* Tables: each cell has a data-label for the phone layout */
.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th {
    padding: 12px 10px;
    font-size: 10px;
    letter-spacing: 1px;
    color: var(--muted);
    background: #fafbf7;
}

td {
    padding: 16px 10px;
    border-bottom: 1px solid var(--border);
    font-size: 12px;
}

tbody tr:last-child td {
    border: 0;
}

td a {
    color: #4d7340;
    font-weight: bold;
}

td small {
    display: block;
    margin-top: 5px;
}

.record-name {
    font-weight: bold;
}

/* Sales pipeline */
.pipeline {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
}

.stage {
    background: #edf1e6;
    border-radius: 11px;
    padding: 16px;
}

.stage>h2 {
    font-size: 14px;
    margin-bottom: 15px;
}

.lead {
    background: white;
    border: 1px solid var(--border);
    border-radius: 9px;
    padding: 17px;
    margin-bottom: 12px;
}

.lead:last-child {
    margin: 0;
}

.lead p {
    font-size: 12px;
    color: var(--muted);
}

/* Forms and ticket conversations */
form {
    display: grid;
    gap: 17px;
}

label {
    display: grid;
    gap: 8px;
    font-size: 13px;
}

input,
select,
textarea {
    width: 100%;
    min-height: 44px;
    padding: 11px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: white;
    color: #253629;
}

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

.form-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-note {
    font-size: 12px;
    color: var(--muted);
    margin: 0;
}

.form-card {
    max-width: 740px;
}

.message {
    padding: 19px 0;
    border-bottom: 1px solid var(--border);
}

.message:first-of-type {
    padding-top: 0;
}

.message p {
    margin: 10px 0 0;
}

.message small {
    display: block;
    margin-top: 5px;
}

.internal {
    padding: 16px;
    border-radius: 8px;
    background: #f7f4e9;
    margin: 16px 0;
}

.reply-form {
    margin-top: 23px;
}

.notice {
    padding: 15px;
    border-radius: 8px;
    background: #edf4e4;
    color: #486d36;
    margin: 15px 0;
}

.notice[hidden] {
    display: none;
}

:focus-visible {
    outline: 3px solid #9fbe6a;
    outline-offset: 3px;
}

/* Tablet and phone layouts */
@media (max-width: 1000px) {
    .cards {
        grid-template-columns: repeat(2, 1fr);
    }

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

@media (max-width: 700px) {
    .sidebar {
        display: none;
    }

    .page {
        margin-left: 0;
    }

    .topbar {
        position: sticky;
        top: 0;
        z-index: 10;
        padding: 12px 16px;
        min-height: 68px;
    }

    .topbar>span {
        display: none;
    }

    .topbar a {
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    .mobile-menu {
        display: block;
        position: relative;
    }

    .mobile-menu summary {
        cursor: pointer;
        padding: 12px;
        border: 1px solid var(--border);
        border-radius: 8px;
        list-style: none;
    }

    .mobile-menu nav {
        position: absolute;
        left: 0;
        top: 52px;
        width: 240px;
        background: white;
        padding: 12px;
        border: 1px solid var(--border);
        border-radius: 10px;
        box-shadow: 0 15px 40px #25362922;
        max-height: 75vh;
        overflow-y: auto;
    }

    .mobile-menu nav a {
        display: block;
        padding: 13px;
        border: 0;
        font-size: 14px;
    }

    .mobile-menu nav a.active {
        background: var(--lime);
    }

    main {
        padding: 24px 16px;
    }

    .page-title {
        flex-direction: column;
        align-items: stretch;
        gap: 18px;
    }

    h1 {
        font-size: 27px;
    }

    .stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }

    .stat {
        padding: 17px;
    }

    .stat strong {
        font-size: 28px;
    }

    .stat small {
        line-height: 1.5;
    }

    .banner {
        flex-direction: column;
        align-items: stretch;
    }

    .cards,
    .pipeline,
    .form-columns {
        grid-template-columns: 1fr;
    }

    .card {
        padding: 20px 16px;
    }

    .table-wrap {
        overflow: visible;
    }

    table,
    tbody {
        display: block;
    }

    thead {
        display: none;
    }

    tbody tr {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        gap: 15px;
        padding: 18px 0;
        border-bottom: 1px solid var(--border);
    }

    tbody tr:last-child {
        border: 0;
    }

    td {
        border: 0;
        padding: 0;
        overflow-wrap: anywhere;
        line-height: 1.5;
    }

    td::before {
        content: attr(data-label);
        display: block;
        font-size: 9px;
        letter-spacing: 1px;
        color: var(--muted);
        margin-bottom: 5px;
    }

    td:first-child {
        grid-column: 1 / -1;
        font-size: 14px;
    }

    td:first-child::before {
        display: none;
    }

    input,
    select,
    textarea {
        font-size: 16px;
    }

    .button {
        font-size: 14px;
        min-height: 46px;
    }

    .button-row .button {
        flex: 1;
    }

    .details {
        font-size: 12px;
    }

    .message p {
        font-size: 14px;
        overflow-wrap: anywhere;
    }
}

/* Client login: responsive HTML form */
.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
}

.login-layout {
    width: 100%;
    max-width: 1080px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 64px;
    align-items: center;
    padding: 56px 32px;
}

.login-intro .brand {
    display: inline-block;
    margin-bottom: 58px;
}

.login-intro .eyebrow {
    display: block;
}

.login-intro h1 {
    font-size: 44px;
    line-height: 1.2;
    margin: 18px 0;
}

.login-intro p {
    max-width: 380px;
    color: var(--muted);
    line-height: 1.8;
}

.login-back {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    margin-top: 24px;
}

.login-card {
    padding: 36px;
    margin: 0;
}

.login-card h2 {
    font-size: 28px;
    margin: 12px 0;
}

.login-card>p {
    color: var(--muted);
    line-height: 1.6;
}

.login-card form {
    gap: 10px;
    margin: 26px 0;
}

.login-card form label:not(:first-child) {
    margin-top: 8px;
}

.login-card button {
    width: 100%;
    margin-top: 12px;
}

.demo-credentials {
    background: #edf4e4;
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 18px;
    font-size: 13px;
    overflow-wrap: anywhere;
}

.demo-credentials p {
    margin: 8px 0 0;
    line-height: 1.9;
}

.login-error {
    color: #9b2c2c;
    background: #fff0ef;
    border-radius: 8px;
    padding: 12px;
    font-size: 13px;
    margin: 0;
}

.login-error[hidden] {
    display: none;
}

.login-help {
    font-size: 13px;
}

.login-help a {
    text-decoration: underline;
}

@media (max-width: 700px) {
    .login-layout {
        grid-template-columns: minmax(0, 1fr);
        padding: 28px 16px;
        gap: 24px;
    }

    .login-intro .brand {
        margin-bottom: 24px;
    }

    .login-intro h1 {
        font-size: 30px;
    }

    .login-intro h1 br {
        display: none;
    }

    .login-card {
        padding: 24px 20px;
    }

    .login-back {
        margin-top: 0;
    }
}

/* Explicit visibility for OTP steps, including grid forms. */
.login-card [hidden] {
    display: none;
}

#otp-step .secondary {
    width: 100%;
    margin: 0 0 20px;
}