/* ============ VetCRM — тёплая клиническая тема ============ */
:root {
    --bg:        #f4f1ea;
    --surface:   #fffdf9;
    --surface-2: #faf7f0;
    --ink:       #2b2620;
    --ink-soft:  #6f685c;
    --line:      #e7e0d3;
    --accent:    #2f8f7e;   /* тёплый зелёно-бирюзовый */
    --accent-d:  #246b5e;
    --accent-sf: #e3f0ec;
    --amber:     #c98a2b;
    --amber-sf:  #f6ecd9;
    --rose:      #c2554e;
    --rose-sf:   #f6e2df;
    --radius:    16px;
    --shadow:    0 1px 2px rgba(43,38,32,.04), 0 8px 24px rgba(43,38,32,.06);
    --shadow-sm: 0 1px 2px rgba(43,38,32,.05), 0 2px 8px rgba(43,38,32,.04);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Nunito Sans', system-ui, sans-serif;
    background: var(--bg);
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
    font-size: 15px;
    line-height: 1.5;
}

a { color: inherit; text-decoration: none; }
h1,h2,h3 { font-family: 'Fraunces', Georgia, serif; font-weight: 600; letter-spacing: -.01em; }

/* ---- Layout ---- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
    width: 248px;
    flex-shrink: 0;
    background: var(--surface);
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    padding: 22px 16px;
    position: sticky;
    top: 0;
    height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 22px; }
.brand-mark { font-size: 26px; }
.brand-text { font-family: 'Fraunces', serif; font-size: 22px; font-weight: 600; }

.nav { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.nav a {
    display: flex; align-items: center; gap: 11px;
    padding: 10px 12px; border-radius: 11px;
    color: var(--ink-soft); font-weight: 600; font-size: 14.5px;
    transition: background .15s, color .15s;
}
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a.is-active { background: var(--accent-sf); color: var(--accent-d); }
.nav-ico { font-size: 17px; width: 20px; text-align: center; }

.sidebar-foot { border-top: 1px solid var(--line); padding-top: 14px; }
.user-chip { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; padding: 4px; }
.user-ava {
    width: 38px; height: 38px; border-radius: 50%;
    background: var(--accent); color: #fff;
    display: grid; place-items: center;
    font-weight: 800; font-size: 16px; flex-shrink: 0;
}
.user-meta { overflow: hidden; }
.user-name { font-weight: 700; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 12px; color: var(--ink-soft); }
.btn-logout {
    width: 100%; padding: 9px; border: 1px solid var(--line);
    background: var(--surface); border-radius: 10px; cursor: pointer;
    font-family: inherit; font-weight: 700; font-size: 13.5px; color: var(--ink-soft);
    transition: background .15s, color .15s;
}
.btn-logout:hover { background: var(--rose-sf); color: var(--rose); border-color: var(--rose-sf); }

/* ---- Content ---- */
.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
    display: flex; align-items: center; justify-content: space-between;
    gap: 16px; padding: 26px 36px 18px;
}
.page-title { font-size: 28px; }
.page-body { padding: 6px 36px 48px; }

/* ---- Cards / grid ---- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px,1fr)); gap: 16px; }
.card {
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow-sm);
    transition: transform .15s, box-shadow .15s;
}
a.card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }

/* ---- Stat row ---- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px,1fr)); gap: 16px; margin-bottom: 26px; }
.stat {
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow-sm);
}
.stat-num { font-family: 'Fraunces', serif; font-size: 34px; font-weight: 600; line-height: 1; }
.stat-label { color: var(--ink-soft); font-size: 13.5px; font-weight: 600; margin-top: 8px; }
.stat.accent .stat-num { color: var(--accent); }
.stat.amber  .stat-num { color: var(--amber); }

/* ---- Section ---- */
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin: 6px 2px 14px; }
.section-head h2 { font-size: 20px; }
.muted { color: var(--ink-soft); font-size: 14px; }

/* ---- Table ---- */
.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-soft); font-weight: 800; padding: 13px 18px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
td { padding: 13px 18px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr { transition: background .12s; }
tbody tr:hover { background: var(--surface-2); }
.row-link { cursor: pointer; }

/* ---- Time pill on dashboard ---- */
.time-pill { font-family: 'Fraunces', serif; font-weight: 600; font-size: 17px; color: var(--accent-d); white-space: nowrap; }

/* ---- Badges ---- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 700; }
.badge.scheduled { background: var(--accent-sf); color: var(--accent-d); }
.badge.done      { background: var(--surface-2); color: var(--ink-soft); border: 1px solid var(--line); }
.badge.cancelled { background: var(--rose-sf); color: var(--rose); }

/* ---- Pet/species chip ---- */
.species { display: inline-flex; align-items: center; gap: 7px; }
.species-ico { font-size: 18px; }

/* ---- Buttons ---- */
.btn {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 10px 16px; border-radius: 11px; border: 1px solid transparent;
    font-family: inherit; font-weight: 700; font-size: 14px; cursor: pointer;
    transition: background .15s, transform .1s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-d); }
.btn-ghost { background: var(--surface); border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { padding: 7px 12px; font-size: 13px; }
.btn-danger { background: var(--rose-sf); color: var(--rose); }
.btn-danger:hover { background: #f0d4d0; }

/* ---- Detail card ---- */
.detail-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 22px; align-items: start; }
@media (max-width: 880px){ .detail-grid { grid-template-columns: 1fr; } }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.panel-head { padding: 16px 20px; border-bottom: 1px solid var(--line); display:flex; align-items:center; justify-content: space-between; }
.panel-head h2, .panel-head h3 { font-size: 18px; }
.panel-body { padding: 18px 20px; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 8px 14px; }
.kv dt { color: var(--ink-soft); font-weight: 600; font-size: 13.5px; }
.kv dd { font-weight: 600; }

.pet-head { display: flex; align-items: center; gap: 16px; padding: 20px; }
.pet-avatar { width: 64px; height: 64px; border-radius: 18px; background: var(--accent-sf); display: grid; place-items: center; font-size: 34px; flex-shrink: 0; }
.pet-head h2 { font-size: 24px; }

/* ---- Back link ---- */
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-soft); font-weight: 700; font-size: 14px; margin-bottom: 14px; }
.back:hover { color: var(--accent-d); }

/* ---- Forms ---- */
.field { margin-bottom: 14px; }
.field label { display: block; font-weight: 700; font-size: 13.5px; margin-bottom: 6px; color: var(--ink-soft); }
.field input, .field select, .field textarea {
    width: 100%; padding: 10px 12px; border: 1px solid var(--line);
    border-radius: 11px; font-family: inherit; font-size: 14.5px; background: var(--surface-2); color: var(--ink);
}
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--accent-sf); border-color: var(--accent); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ---- Empty ---- */
.empty { text-align: center; padding: 48px 20px; color: var(--ink-soft); }
.empty-ico { font-size: 42px; margin-bottom: 10px; }

/* ---- Search ---- */
.search { margin-bottom: 18px; }
.search input { width: 100%; max-width: 420px; padding: 11px 16px; border: 1px solid var(--line); border-radius: 12px; font-family: inherit; font-size: 14.5px; background: var(--surface); }
.search input:focus { outline: 2px solid var(--accent-sf); border-color: var(--accent); }

/* ---- Login ---- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px;
    background: radial-gradient(1200px 600px at 70% -10%, var(--accent-sf), transparent), var(--bg); }
.login-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 38px 34px; box-shadow: var(--shadow); }
.login-logo { font-size: 46px; text-align: center; }
.login-card h1 { text-align: center; font-size: 27px; margin: 8px 0 4px; }
.login-sub { text-align: center; color: var(--ink-soft); margin-bottom: 24px; font-size: 14px; }
.login-card .btn-primary { width: 100%; justify-content: center; margin-top: 6px; padding: 12px; }
.login-hint { margin-top: 20px; padding: 12px 14px; background: var(--accent-sf); border-radius: 12px; font-size: 13px; color: var(--accent-d); text-align: center; }
.login-hint code { background: rgba(255,255,255,.6); padding: 1px 6px; border-radius: 5px; font-weight: 800; }
.login-err { background: var(--rose-sf); color: var(--rose); padding: 11px 14px; border-radius: 11px; font-size: 14px; font-weight: 700; margin-bottom: 16px; text-align: center; }

.tag { font-size: 12.5px; color: var(--ink-soft); }
.pet-mini { display:inline-flex; align-items:center; gap:6px; padding: 4px 10px; background: var(--surface-2); border:1px solid var(--line); border-radius: 999px; font-weight:600; font-size:13px; }

@media (max-width: 720px){
    .sidebar { position: fixed; z-index: 50; transform: translateX(-100%); transition: transform .2s; }
    .topbar, .page-body { padding-left: 18px; padding-right: 18px; }
    .detail-grid { grid-template-columns: 1fr; }
    .field-row { grid-template-columns: 1fr; }
}
