/* ═══════════════════════════════════════════════════════════
   RECEITUARIO — Design System Global
   Salvar em: public_html/includes/css/global.css
   ═══════════════════════════════════════════════════════════ */

:root {
    --ink:        #1c1917;
    --ink-mid:    #44403c;
    --ink-light:  #78716c;
    --ink-ghost:  #a8a29e;
    --gold:       #b5884a;
    --gold-light: #d4a96a;
    --gold-bg:    #fdf6e7;
    --gold-soft:  #f5edd8;
    --cream:      #faf8f4;
    --cream-2:    #f2ede4;
    --border:     #e5ded4;
    --white:      #ffffff;
    --green:      #1a8a5a;
    --red:        #c0392b;
    --teal:       #0d6e6e;
    --orange:     #c2690a;
    --radius:     14px;
    --radius-sm:  9px;
    --shadow-sm:  0 1px 4px rgba(28,25,23,.05);
    --shadow-md:  0 4px 16px rgba(28,25,23,.10);
    --shadow-lg:  0 8px 32px rgba(28,25,23,.14);
    --transition: .15s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
    font-family: 'DM Sans', sans-serif;
    background: var(--cream);
    color: var(--ink);
    min-height: 100vh;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
img { display: block; max-width: 100%; }
button, input, select, textarea { font-family: inherit; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--cream-2); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--ink-ghost); }

.page-wrap {
    max-width: 1100px;
    margin: 0 auto;
    padding: 36px 24px 100px;
}
.cfg-wrap {
    max-width: 780px;
    margin: 0 auto;
    padding: 36px 24px 100px;
}
@media (max-width: 600px) {
    .page-wrap, .cfg-wrap { padding: 20px 14px 80px; }
}

.page-header { margin-bottom: 28px; }
.page-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--ink);
    letter-spacing: -.4px;
}
.page-sub { font-size: .78rem; color: var(--ink-ghost); margin-top: 3px; }

.card, .cfg-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 12px;
}
.card-padded, .cfg-card { padding: 22px 24px; }
@media (max-width: 600px) {
    .card-padded, .cfg-card { padding: 18px 16px; }
}
.card-head, .cfg-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
}
.card-title, .cfg-card-title {
    font-size: .62rem;
    font-weight: 600;
    color: var(--gold);
    text-transform: uppercase;
    letter-spacing: 2px;
    display: flex;
    align-items: center;
    gap: 7px;
}
.card-title-gold { color: var(--gold); }
.card-action { font-size: .75rem; color: var(--gold); text-decoration: none; font-weight: 500; }
.card-action:hover { text-decoration: underline; }
.cfg-card-meta { font-size: .72rem; color: var(--ink-ghost); }
.opt-tag {
    font-size: .62rem;
    background: #f0efee;
    border-radius: 4px;
    padding: 2px 7px;
    color: var(--ink-ghost);
}

.field { margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }
.field > label {
    display: block;
    font-size: .72rem;
    font-weight: 500;
    color: var(--ink-mid);
    margin-bottom: 6px;
}
.fi {
    width: 100%;
    padding: 10px 13px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: .88rem;
    color: var(--ink);
    background: var(--cream);
    outline: none;
    transition: border var(--transition), box-shadow var(--transition);
    -webkit-appearance: none;
    appearance: none;
}
.fi:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(181,136,74,.12); }
.fi::placeholder { color: #c4b9af; }
.fi-hint { font-size: .68rem; color: var(--ink-ghost); margin-top: 5px; line-height: 1.4; }

.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.row3 { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 14px; }
.row4 { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 14px; }
@media (max-width: 600px) {
    .row2, .row3, .row4 { grid-template-columns: 1fr; gap: 0; }
    .row2 .field, .row3 .field, .row4 .field { margin-bottom: 14px; }
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 10px 22px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: .88rem;
    font-weight: 500;
    cursor: pointer;
    transition: all .18s;
    text-decoration: none;
    white-space: nowrap;
    line-height: 1;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--ink); color: var(--white); }
.btn-primary:hover { background: #2d2926; transform: translateY(-1px); box-shadow: 0 4px 14px rgba(28,25,23,.18); }
.btn-gold { background: var(--gold); color: var(--white); }
.btn-gold:hover { background: var(--gold-light); transform: translateY(-1px); box-shadow: 0 4px 14px rgba(181,136,74,.3); }
.btn-ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--border); }
.btn-ghost:hover { background: var(--cream-2); }
.btn-danger { background: var(--red); color: var(--white); }
.btn-danger:hover { background: #a93226; transform: translateY(-1px); }
.btn-teal { background: var(--teal); color: var(--white); }
.btn-teal:hover { background: #0a5959; transform: translateY(-1px); }
.btn-sm { padding: 7px 14px; font-size: .78rem; }
.btn-lg { padding: 13px 32px; font-size: .95rem; }
.btn-block { width: 100%; }
.btn-disabled, .btn:disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }

.btn-save {
    padding: 11px 30px;
    background: var(--ink);
    color: var(--white);
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: .88rem;
    font-weight: 500;
    cursor: pointer;
    transition: all .18s;
    display: inline-flex;
    align-items: center;
    gap: 7px;
}
.btn-save:hover { background: var(--gold); transform: translateY(-1px); box-shadow: 0 4px 14px rgba(181,136,74,.25); }
.btn-save:active { transform: none; }
.save-bar { display: flex; justify-content: flex-end; padding-top: 6px; }

.btn-copy {
    padding: 7px 13px;
    border: 1px solid rgba(181,136,74,.3);
    background: rgba(181,136,74,.1);
    color: var(--gold);
    border-radius: 7px;
    font-size: .75rem;
    cursor: pointer;
    font-family: inherit;
    white-space: nowrap;
    transition: all var(--transition);
    flex-shrink: 0;
}
.btn-copy:hover { background: rgba(181,136,74,.2); }
.btn-copy:active { transform: scale(.96); }

.alert {
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    font-size: .82rem;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 9px;
}
.alert-ok   { background: #e6f6f0; border: 1px solid #b2e0cc; color: #1a8a5a; }
.alert-err  { background: #fde8e8; border: 1px solid #f5c6c6; color: #c0392b; }
.alert-warn { background: #fff8e6; border: 1px solid #f5dfa0; color: #92600a; }
.alert-info { background: #e8f4fd; border: 1px solid #b3d9f5; color: #1a5f8a; }

.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 9px;
    border-radius: 99px;
    font-size: .68rem;
    font-weight: 600;
    letter-spacing: .3px;
    white-space: nowrap;
}
.badge-green  { background: #e6f6f0; color: #1a8a5a; }
.badge-gold   { background: var(--gold-bg); color: var(--gold); }
.badge-red    { background: #fde8e8; color: #c0392b; }
.badge-orange { background: #fff3e0; color: #c2690a; }
.badge-gray   { background: #f0efee; color: var(--ink-ghost); }
.badge-teal   { background: #e0f2f1; color: #0d6e6e; }

.tag-gold  { background: var(--gold-bg); color: var(--gold); border-radius: 4px; padding: 2px 7px; font-size: .62rem; font-weight: 600; }
.tag-teal  { background: #e0f2f1; color: var(--teal); border-radius: 4px; padding: 2px 7px; font-size: .62rem; font-weight: 600; }
.tag-green { background: #e6f6f0; color: var(--green); border-radius: 4px; padding: 2px 7px; font-size: .62rem; font-weight: 600; }
.tag-red   { background: #fde8e8; color: var(--red); border-radius: 4px; padding: 2px 7px; font-size: .62rem; font-weight: 600; }
.tag-gray  { background: #f0efee; color: var(--ink-ghost); border-radius: 4px; padding: 2px 7px; font-size: .62rem; font-weight: 600; }

.table { width: 100%; border-collapse: collapse; font-size: .83rem; }
.table th {
    text-align: left;
    font-size: .62rem;
    font-weight: 600;
    color: var(--ink-ghost);
    text-transform: uppercase;
    letter-spacing: 1.2px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    background: var(--cream);
}
.table td {
    padding: 11px 12px;
    border-bottom: 1px solid #f5f0e8;
    color: var(--ink);
    vertical-align: middle;
}
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--cream); }

.info-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #f5f0e8;
    font-size: .83rem;
}
.info-row:last-child { border-bottom: none; }
.info-lbl { font-size: .73rem; color: var(--ink-ghost); }
.info-val { font-weight: 500; color: var(--ink); }

.link-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: linear-gradient(135deg, #fdf6e7, #faf3e0);
    border: 1px solid rgba(181,136,74,.22);
    border-radius: 10px;
    padding: 13px 15px;
    margin-bottom: 14px;
}
.link-box-lbl { font-size: .58rem; color: var(--ink-ghost); text-transform: uppercase; letter-spacing: 1.3px; margin-bottom: 4px; }
.link-box-url { font-size: .88rem; color: var(--gold); font-weight: 600; word-break: break-all; }

.link-tip {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    background: #eef6f2;
    border: 1px solid rgba(13,110,110,.15);
    border-radius: 8px;
    padding: 10px 13px;
    margin-bottom: 16px;
    font-size: .76rem;
    color: var(--teal);
    line-height: 1.6;
}

.tz-clock {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--gold-soft);
    border: 1px solid rgba(181,136,74,.2);
    border-radius: 8px;
    padding: 10px 13px;
    margin-top: 9px;
}
.tz-clock-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--gold); flex-shrink: 0; }
.tz-clock-time { font-family: 'Playfair Display', serif; font-size: 1.1rem; font-weight: 600; color: var(--ink); }
.tz-clock-label { font-size: .67rem; color: var(--ink-ghost); }

.tz-wrap { position: relative; }
.tz-wrap select { appearance: none; padding-right: 36px; cursor: pointer; }
.tz-wrap::after {
    content: '';
    position: absolute;
    right: 13px; top: 50%;
    transform: translateY(-50%);
    width: 0; height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid var(--ink-ghost);
    pointer-events: none;
}

.slug-wrap {
    display: flex;
    align-items: stretch;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--cream);
    transition: border var(--transition), box-shadow var(--transition);
}
.slug-wrap:focus-within { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(181,136,74,.12); }
.slug-prefix {
    padding: 10px 11px;
    font-size: .72rem;
    color: var(--ink-ghost);
    background: #ede8e0;
    border-right: 1px solid var(--border);
    white-space: nowrap;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}
.slug-field {
    flex: 1;
    padding: 10px 12px;
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: .9rem;
    color: var(--ink);
    outline: none;
}

.doc-preview { background: var(--ink); border-radius: 12px; padding: 20px 22px; }
.doc-preview-tag { font-size: .58rem; color: rgba(255,255,255,.28); text-transform: uppercase; letter-spacing: 1.5px; margin-bottom: 8px; }
.doc-preview-bar { height: 2px; width: 28px; background: var(--gold); border-radius: 2px; margin-bottom: 10px; }
.doc-preview-name { font-family: 'Playfair Display', serif; font-size: 1rem; color: var(--white); }
.doc-preview-crm { font-size: .73rem; color: rgba(255,255,255,.42); margin-top: 2px; }
.doc-preview-clinic { font-size: .71rem; color: rgba(255,255,255,.3); margin-top: 2px; }

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}
.kpi {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    box-shadow: var(--shadow-sm);
}
.kpi.dark  { background: var(--ink); border-color: var(--ink); }
.kpi.teal  { background: var(--teal); border-color: var(--teal); }
.kpi.green { background: var(--green); border-color: var(--green); }
.kpi-lbl {
    font-size: .62rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.4px;
    color: var(--ink-ghost);
    margin-bottom: 6px;
}
.kpi.dark .kpi-lbl,
.kpi.teal .kpi-lbl,
.kpi.green .kpi-lbl { color: rgba(255,255,255,.55); }
.kpi-val {
    font-family: 'Playfair Display', serif;
    font-size: 1.7rem;
    font-weight: 600;
    color: var(--ink);
    line-height: 1;
}
.kpi.dark .kpi-val,
.kpi.teal .kpi-val,
.kpi.green .kpi-val { color: var(--white); }
.kpi-sub { font-size: .7rem; color: var(--ink-ghost); margin-top: 4px; }
.kpi.dark .kpi-sub,
.kpi.teal .kpi-sub,
.kpi.green .kpi-sub { color: rgba(255,255,255,.4); }

.shortcuts {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 10px;
    margin-bottom: 20px;
}
.shortcut {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 12px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-decoration: none;
    transition: all .18s;
    cursor: pointer;
    text-align: center;
}
.shortcut:hover { border-color: var(--gold); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.sc-icon  { font-size: 1.5rem; }
.sc-label { font-size: .78rem; font-weight: 500; color: var(--ink); }
.sc-sub   { font-size: .65rem; color: var(--ink-ghost); }

.sidebar-dark {
    background: var(--ink);
    border-radius: var(--radius);
    padding: 22px 20px;
    color: var(--white);
    position: sticky;
    top: 80px;
}
.sidebar-divider { height: 1px; background: rgba(255,255,255,.08); margin: 14px 0; }
.sidebar-info-box { background: rgba(255,255,255,.06); border-radius: 10px; padding: 14px 16px; margin-top: 10px; }
.sidebar-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0;
    font-size: .78rem;
    border-bottom: 1px solid rgba(255,255,255,.06);
}
.sidebar-info-row:last-child { border-bottom: none; }
.save-btn-sidebar {
    width: 100%;
    padding: 12px;
    background: var(--gold);
    color: var(--white);
    border: none;
    border-radius: 10px;
    font-family: inherit;
    font-size: .9rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 16px;
    transition: all .18s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.save-btn-sidebar:hover { background: var(--gold-light); transform: translateY(-1px); }

.result-panel { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-sm); }
.result-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 16px; }
.result-card { background: var(--cream); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; text-align: center; }
.result-sidebar { background: var(--ink); border-radius: var(--radius); padding: 20px; color: var(--white); }
.orc-line { display: flex; justify-content: space-between; font-size: .82rem; padding: 5px 0; border-bottom: 1px solid rgba(255,255,255,.07); }
.orc-line:last-child { border-bottom: none; }
.orc-total { display: flex; justify-content: space-between; font-size: 1rem; font-weight: 700; color: var(--gold-light); margin-top: 10px; padding-top: 10px; border-top: 1px solid rgba(255,255,255,.15); }
.orc-desconto { font-size: .75rem; color: rgba(255,255,255,.45); margin-top: 3px; }

.breakdown-box { background: var(--cream); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; font-size: .82rem; }
.breakdown-row { display: flex; justify-content: space-between; padding: 4px 0; border-bottom: 1px solid #ede8e0; }
.breakdown-row:last-child { border-bottom: none; }

.toast {
    position: fixed;
    bottom: 24px; right: 24px;
    background: var(--ink);
    color: var(--white);
    padding: 12px 18px;
    border-radius: 10px;
    font-size: .82rem;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 9px;
    transform: translateY(80px);
    opacity: 0;
    transition: all .3s ease;
    max-width: 320px;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast.toast-ok   { background: var(--green); }
.toast.toast-err  { background: var(--red); }
.toast.toast-gold { background: var(--gold); }

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(28,25,23,.55);
    backdrop-filter: blur(3px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.modal-overlay.active { display: flex; }
.modal { background: var(--white); border-radius: var(--radius); padding: 28px 28px 24px; max-width: 480px; width: 100%; box-shadow: var(--shadow-lg); position: relative; }
.modal-title { font-family: 'Playfair Display', serif; font-size: 1.15rem; font-weight: 600; margin-bottom: 16px; }
.modal-close { position: absolute; top: 16px; right: 16px; width: 28px; height: 28px; background: var(--cream-2); border: none; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: .9rem; color: var(--ink-ghost); transition: background var(--transition); }
.modal-close:hover { background: var(--border); }
.modal-footer { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

.tabs { display: flex; gap: 4px; background: var(--cream-2); border-radius: 10px; padding: 4px; margin-bottom: 20px; overflow-x: auto; }
.tab-btn { flex: 1; min-width: max-content; padding: 8px 16px; border: none; background: transparent; border-radius: 7px; font-family: inherit; font-size: .8rem; font-weight: 500; color: var(--ink-ghost); cursor: pointer; transition: all var(--transition); white-space: nowrap; }
.tab-btn.active { background: var(--white); color: var(--ink); box-shadow: 0 1px 4px rgba(28,25,23,.1); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
@media (max-width: 768px) { .auth-wrap { grid-template-columns: 1fr; } .auth-brand { display: none; } }
.auth-brand { background: var(--ink); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 60px 40px; position: relative; overflow: hidden; }
.auth-brand::before { content: ''; position: absolute; width: 400px; height: 400px; border-radius: 50%; background: radial-gradient(circle, rgba(181,136,74,.18) 0%, transparent 70%); top: -100px; right: -100px; }
.auth-form-side { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 60px 40px; background: var(--cream); }
@media (max-width: 768px) { .auth-form-side { padding: 40px 24px; } }
.auth-box { width: 100%; max-width: 400px; }
.auth-logo { font-family: 'Playfair Display', serif; font-size: 1.4rem; font-weight: 600; color: var(--white); margin-bottom: 8px; }
.auth-tagline { font-size: .8rem; color: rgba(255,255,255,.45); }

.brand-mark { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-icon { width: 32px; height: 32px; background: var(--gold); border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: .9rem; }
.brand-name { font-family: 'Playfair Display', serif; font-size: 1.05rem; font-weight: 600; color: var(--ink); }

.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--gold-bg); border: 2px solid var(--gold); display: flex; align-items: center; justify-content: center; font-size: .8rem; font-weight: 600; color: var(--gold); flex-shrink: 0; }
.avatar-lg { width: 56px; height: 56px; font-size: 1.1rem; }

.search-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; }
.search-input-wrap { flex: 1; min-width: 200px; position: relative; }
.search-input-wrap .fi { padding-left: 36px; }
.search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--ink-ghost); pointer-events: none; }

.text-gold   { color: var(--gold); }
.text-green  { color: var(--green); }
.text-red    { color: var(--red); }
.text-teal   { color: var(--teal); }
.text-ghost  { color: var(--ink-ghost); }
.text-mid    { color: var(--ink-mid); }
.text-sm     { font-size: .8rem; }
.text-xs     { font-size: .7rem; }
.text-center { text-align: center; }
.text-right  { text-align: right; }
.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.mt-4  { margin-top:  4px; } .mt-8  { margin-top:  8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-20 { margin-top: 20px; }
.mb-4  { margin-bottom:  4px; } .mb-8  { margin-bottom:  8px; } .mb-12 { margin-bottom: 12px; } .mb-16 { margin-bottom: 16px; } .mb-20 { margin-bottom: 20px; }
.flex         { display: flex; }
.flex-center  { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.hidden { display: none !important; }
.w-full { width: 100%; }

@media print {
    .no-print { display: none !important; }
    body { background: white; color: black; }
    .card, .cfg-card { box-shadow: none; border: 1px solid #ccc; }
}