:root {
    --bg: #f7faf9;
    --surface: #ffffff;
    --surface-soft: #eef7f5;
    --text: #1f2933;
    --muted: #64748b;
    --line: #d9e2e1;
    --primary: #0f766e;
    --primary-dark: #115e59;
    --accent: #b7791f;
    --danger: #b91c1c;
    --success: #15803d;
    --warning: #a16207;
    --shadow: 0 10px 25px rgba(15, 23, 42, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 16px;
    line-height: 1.5;
}

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

h1, h2, h3, p {
    margin-top: 0;
}

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

input, select, textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px 12px;
    background: #fff;
    color: var(--text);
}

textarea {
    resize: vertical;
}

label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-weight: 700;
}

label input,
label select,
label textarea {
    font-weight: 400;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 12px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

th {
    color: var(--muted);
    font-size: 0.9rem;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 64px;
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.96);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(10px);
}

.brand,
.topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand {
    color: var(--text);
    font-weight: 800;
}

.brand-mark {
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 8px;
    background: var(--primary);
    color: #fff;
}

.notification-pill,
.user-chip {
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 8px 12px;
    background: #fff;
    color: var(--text);
}

.notification-pill strong {
    display: inline-grid;
    place-items: center;
    min-width: 22px;
    height: 22px;
    margin-left: 5px;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
}

.app-shell {
    display: grid;
    grid-template-columns: 230px minmax(0, 1fr);
    min-height: calc(100vh - 64px);
}

.sidebar {
    padding: 18px;
    border-right: 1px solid var(--line);
    background: #fff;
}

.sidebar a {
    display: block;
    padding: 10px 12px;
    border-radius: 8px;
    color: var(--text);
    font-weight: 700;
}

.sidebar a:hover {
    background: var(--surface-soft);
    color: var(--primary-dark);
}

.content {
    width: 100%;
    max-width: 1240px;
    margin: 0 auto;
    padding: 24px;
}

.page-header,
.panel-head,
.toolbar,
.form-inline,
.row-actions,
.appointment-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
}

.page-header {
    margin-bottom: 20px;
}

.page-header h1 {
    margin-bottom: 4px;
    font-size: 2rem;
}

.page-header p,
.panel-head p {
    color: var(--muted);
    margin-bottom: 0;
}

.panel,
.metric,
.appointment-card,
.public-panel,
.auth-panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.panel {
    padding: 18px;
    margin-bottom: 18px;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 18px;
}

.metric {
    padding: 18px;
}

.metric span {
    color: var(--muted);
    font-weight: 700;
}

.metric strong {
    display: block;
    margin-top: 8px;
    font-size: 1.7rem;
}

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

.form-grid,
.toolbar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.toolbar {
    grid-template-columns: repeat(5, minmax(140px, 1fr));
    align-items: end;
    margin-bottom: 18px;
}

.span-2 {
    grid-column: span 2;
}

.stack {
    display: grid;
    gap: 18px;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 9px 14px;
    background: #fff;
    color: var(--text);
    font-weight: 800;
    cursor: pointer;
}

.button.primary {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
}

.button.ghost {
    background: var(--surface-soft);
    color: var(--primary-dark);
}

.button.accent {
    border-color: var(--accent);
    background: #fff7ed;
    color: #854d0e;
}

.button.small {
    min-height: 34px;
    padding: 6px 10px;
    font-size: 0.9rem;
}

.list-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
}

.list-row:last-child {
    border-bottom: 0;
}

.list-row span,
.table-subtitle,
.note,
.empty {
    display: block;
    color: var(--muted);
}

.unread {
    background: #f0fdfa;
}

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    border-radius: 999px;
    padding: 4px 10px;
    background: var(--surface-soft);
    color: var(--primary-dark);
    font-weight: 800;
    font-size: 0.86rem;
}

.flash-stack {
    position: fixed;
    right: 18px;
    top: 78px;
    z-index: 30;
    display: grid;
    gap: 8px;
    max-width: 380px;
}

.flash {
    border-radius: 8px;
    padding: 12px 14px;
    box-shadow: var(--shadow);
    background: #fff;
}

.flash.success {
    border-left: 4px solid var(--success);
}

.flash.error {
    border-left: 4px solid var(--danger);
}

.flash.warning {
    border-left: 4px solid var(--warning);
}

.agenda-grid {
    display: grid;
    gap: 14px;
    margin-bottom: 18px;
}

.appointment-card {
    display: grid;
    grid-template-columns: 170px 1fr auto;
    gap: 16px;
    padding: 16px;
    border-left: 5px solid var(--primary);
}

.status-pendente {
    border-left-color: var(--warning);
}

.status-cancelado,
.status-faltou {
    border-left-color: var(--danger);
    opacity: 0.82;
}

.status-concluido {
    border-left-color: var(--success);
}

.appointment-time strong,
.appointment-time span {
    display: block;
}

.appointment-actions form {
    display: flex;
    gap: 8px;
    align-items: center;
}

.auth-wrap,
.public-wrap {
    width: min(960px, calc(100% - 32px));
    margin: 0 auto;
    padding: 40px 0;
}

.auth-panel,
.public-panel {
    padding: 24px;
    margin-bottom: 18px;
}

.auth-panel {
    max-width: 460px;
    margin: 60px auto;
}

.public-hero {
    padding: 20px 0 10px;
}

.public-hero h1 {
    font-size: 2.3rem;
    margin-bottom: 6px;
}

.eyebrow {
    color: var(--accent);
    font-weight: 900;
    text-transform: uppercase;
    font-size: 0.82rem;
}

.slot-grid,
.shortcut-grid,
.check-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
}

.slot {
    min-height: 64px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px;
    text-align: center;
    font-weight: 900;
}

.slot small {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-weight: 700;
}

.slot.available {
    background: #ecfdf5;
    color: #065f46;
    cursor: pointer;
}

.slot.available.selected {
    outline: 3px solid #0f766e;
}

.slot.unavailable {
    display: grid;
    place-items: center;
    background: #f1f5f9;
    color: var(--muted);
}

.selected-slot,
.callout {
    grid-column: span 2;
    border-radius: 8px;
    padding: 12px;
    background: var(--surface-soft);
    color: var(--primary-dark);
    font-weight: 800;
}

.error-text {
    color: var(--danger);
}

.checkbox-line {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
}

.checkbox-line input {
    width: auto;
}

.hours-grid {
    display: grid;
    gap: 12px;
}

.hour-row {
    display: grid;
    grid-template-columns: 140px 1fr 1fr;
    gap: 12px;
    align-items: end;
}

.table-wrap {
    overflow-x: auto;
}

.shortcut {
    display: grid;
    place-items: center;
    min-height: 64px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-soft);
    color: var(--primary-dark);
    font-weight: 900;
}

.centered {
    text-align: center;
}

.wide {
    grid-column: 1 / -1;
}

.muted-link {
    display: inline-block;
    margin-top: 16px;
    color: var(--muted);
}

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

    .sidebar {
        display: flex;
        gap: 8px;
        overflow-x: auto;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .metric-grid,
    .two-columns,
    .form-grid,
    .toolbar {
        grid-template-columns: 1fr;
    }

    .span-2,
    .selected-slot,
    .callout {
        grid-column: auto;
    }

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

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

    .topbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .topbar-actions {
        width: 100%;
        overflow-x: auto;
    }
}

