:root {
    --green-primary: #E8A33D;
    --green-light:   rgba(232,163,61,.12);
    --green-dark:    #C17F1E;
    --danger:        #E88A8A;
    --warning:       #E8A33D;
    --text-dark:     #F8F4EC;
    --text-muted:    #A69E8F;
    --bg:            #1A1613;
    --white:         #241F1A;
    --border:        #3A332C;
    --shadow-sm:     0 1px 3px rgba(0,0,0,.35);
    --shadow-md:     0 12px 30px rgba(0,0,0,.5);
    --radius:        12px;
    --radius-sm:     8px;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Inter','Segoe UI', system-ui, -apple-system, sans-serif; background: var(--bg); color: var(--text-dark); line-height: 1.6; min-height: 100vh; }
h1, h2, h3, .logo, .card-header h2 { font-family: 'Fraunces', serif; font-weight: 600; }
a { color: var(--green-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* NAV */
.navbar { background: var(--white); border-bottom: 1px solid var(--border); padding: 0 2rem; display: flex; align-items: center; justify-content: space-between; height: 64px; box-shadow: var(--shadow-sm); position: sticky; top: 0; z-index: 100; }
.navbar .logo { font-size: 1.4rem; font-weight: 700; color: var(--green-primary); letter-spacing: -.5px; text-decoration: none; }
.navbar .logo span { color: var(--text-dark); }
.navbar nav a { color: var(--text-muted); font-weight: 500; padding: .4rem .8rem; border-radius: var(--radius-sm); transition: background .2s, color .2s; }
.navbar nav a:hover { background: var(--green-light); color: var(--green-primary); text-decoration: none; }
.navbar nav a.btn-nav { background: var(--green-primary); color: #1A1613; margin-left: .5rem; }
.navbar nav a.btn-nav:hover { background: var(--green-dark); color: #1A1613; }

/* LAYOUT */
.container { max-width: 1100px; margin: 0 auto; padding: 0 1.5rem; }
.page-header { padding: 2.5rem 0 1.5rem; }
.page-header h1 { font-size: 1.8rem; font-weight: 700; }
.page-header p { color: var(--text-muted); margin-top: .3rem; }

/* CARDS */
.card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow-sm); border: 1px solid var(--border); padding: 1.5rem; }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.2rem; padding-bottom: .8rem; border-bottom: 1px solid var(--border); }
.card-header h2 { font-size: 1.1rem; font-weight: 600; }

/* FORMS */
.form-group { margin-bottom: 1.2rem; }
.form-group label { display: block; font-weight: 600; font-size: .875rem; margin-bottom: .4rem; }
.form-group input, .form-group select, .form-group textarea { width: 100%; padding: .65rem .9rem; border: 1.5px solid var(--border); border-radius: var(--radius-sm); font-size: .95rem; color: var(--text-dark); background: var(--white); transition: border-color .2s; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { outline: none; border-color: var(--green-primary); box-shadow: 0 0 0 3px rgba(232,163,61,.15); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-hint { font-size: .8rem; color: var(--text-muted); margin-top: .3rem; }

/* BUTTONS */
.btn { display: inline-flex; align-items: center; gap: .4rem; padding: .65rem 1.3rem; border-radius: var(--radius-sm); font-size: .9rem; font-weight: 600; cursor: pointer; border: none; transition: background .2s, transform .1s; text-decoration: none; }
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-primary { background: var(--green-primary); color: #1A1613; }
.btn-primary:hover { background: var(--green-dark); color: #1A1613; }
.btn-outline { background: transparent; color: var(--green-primary); border: 1.5px solid var(--green-primary); }
.btn-outline:hover { background: var(--green-light); }
.btn-sm { padding: .4rem .8rem; font-size: .82rem; }
.btn-full { width: 100%; justify-content: center; }

/* ALERTS */
.alert { padding: .85rem 1.1rem; border-radius: var(--radius-sm); font-size: .9rem; margin-bottom: 1.2rem; }
.alert-error   { background: rgba(232,138,138,.1); border-left: 4px solid var(--danger); color: #F0AFAF; }
.alert-success { background: var(--green-light); border-left: 4px solid var(--green-primary); color: var(--green-primary); }
.alert-warning { background: rgba(232,163,61,.1); border-left: 4px solid var(--warning); color: #F0C583; }

/* BADGES */
.badge { display: inline-block; padding: .2rem .6rem; border-radius: 20px; font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.badge-green   { background: var(--green-light); color: var(--green-primary); }
.badge-danger  { background: rgba(232,138,138,.12); color: var(--danger); }
.badge-warning { background: rgba(232,163,61,.12); color: var(--warning); }
.badge-blue    { background: rgba(92,140,239,.14); color: #8FB2F5; }

/* ANIMAL GRID */
.animals-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1.2rem; margin-top: 1.5rem; }
.animal-card { background: var(--white); border-radius: var(--radius); border: 1.5px solid var(--border); padding: 1.3rem; cursor: pointer; transition: border-color .2s, box-shadow .2s, transform .2s; }
.animal-card:hover { border-color: var(--green-primary); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.animal-card .species-icon { font-size: 2.5rem; margin-bottom: .6rem; }
.animal-card h3 { font-size: 1.1rem; font-weight: 700; }
.animal-card p { font-size: .875rem; color: var(--text-muted); margin-top: .2rem; }
.animal-card .code-badge { margin-top: 1rem; padding: .5rem .8rem; background: var(--green-light); border-radius: var(--radius-sm); font-family: 'Courier New', monospace; font-size: 1.3rem; font-weight: 700; letter-spacing: .3em; color: var(--green-dark); text-align: center; }

/* CODE BOX */
.code-box { background: var(--green-light); border: 2px dashed var(--green-primary); border-radius: var(--radius); padding: 1.5rem; text-align: center; }
.code-box .code-display { font-family: 'Courier New', monospace; font-size: 3rem; font-weight: 700; letter-spacing: .5em; color: var(--green-dark); line-height: 1; margin: .5rem 0; }

/* VET PAGE */
.vet-hero { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #E8A33D 0%, #C17F1E 100%); padding: 2rem; }
.vet-card { background: var(--white); border-radius: 16px; box-shadow: 0 20px 60px rgba(0,0,0,.2); padding: 2.5rem 3rem; width: 100%; max-width: 420px; text-align: center; }
.vet-card .logo-big { font-size: 2rem; font-weight: 800; color: var(--green-primary); margin-bottom: 1.5rem; }
.vet-card h1 { font-size: 1.3rem; margin-bottom: .5rem; }
.vet-card > p { color: var(--text-muted); margin-bottom: 1.8rem; font-size: .9rem; }
.code-inputs { display: flex; gap: .6rem; justify-content: center; margin-bottom: 1.5rem; }
.code-inputs input { width: 64px; height: 72px; font-size: 2rem; font-weight: 700; text-align: center; border: 2px solid var(--border); border-radius: 10px; font-family: 'Courier New', monospace; color: var(--green-dark); background: var(--bg); transition: border-color .2s; }
.code-inputs input:focus { outline: none; border-color: var(--green-primary); box-shadow: 0 0 0 4px rgba(232,163,61,.18); background: var(--white); }

/* VET RECORD */
.vet-record { max-width: 860px; margin: 2rem auto; padding: 0 1.5rem 3rem; }
.animal-header { background: linear-gradient(135deg, var(--green-primary), var(--green-dark)); color: var(--white); border-radius: var(--radius); padding: 2rem; display: flex; gap: 1.5rem; align-items: center; margin-bottom: 1.5rem; }
.animal-header .emoji { font-size: 4rem; }
.animal-header h1 { font-size: 1.8rem; font-weight: 800; }
.animal-header p { opacity: .85; margin-top: .2rem; }
.info-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .8rem; margin-bottom: 1.5rem; }
.info-item { background: var(--white); border-radius: var(--radius-sm); padding: .9rem 1rem; border: 1px solid var(--border); }
.info-item .label { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); font-weight: 600; }
.info-item .value { font-size: 1rem; font-weight: 600; margin-top: .2rem; }

/* TABLES */
table { width: 100%; border-collapse: collapse; }
th, td { padding: .75rem 1rem; text-align: left; font-size: .875rem; }
th { background: var(--bg); font-weight: 600; color: var(--text-muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; border-bottom: 1px solid var(--border); }
td { border-bottom: 1px solid var(--border); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg); }

/* AUTH */
.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); padding: 2rem; }
.auth-card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow-md); padding: 2.5rem; width: 100%; max-width: 440px; }
.auth-card h1 { font-size: 1.5rem; font-weight: 700; margin-bottom: .4rem; }
.auth-card .subtitle { color: var(--text-muted); margin-bottom: 2rem; font-size: .9rem; }

/* TABS */
.tabs { display: flex; border-bottom: 2px solid var(--border); margin-bottom: 1.5rem; flex-wrap: wrap; }
.tab-btn { padding: .65rem 1rem; font-size: .85rem; font-weight: 600; color: var(--text-muted); cursor: pointer; border: none; background: none; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: color .2s, border-color .2s; white-space: nowrap; }
.tab-btn.active { color: var(--green-primary); border-bottom-color: var(--green-primary); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* EMPTY STATE */
.empty-state { text-align: center; padding: 2.5rem 1rem; color: var(--text-muted); }
.empty-state .icon { font-size: 2.5rem; margin-bottom: .8rem; }
.empty-state h3 { font-weight: 600; color: var(--text-dark); }

/* ATTEMPTS */
.attempts-bar { display: flex; gap: .4rem; justify-content: center; margin-bottom: .8rem; }
.attempt-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--border); }
.attempt-dot.used { background: var(--danger); }

/* DELETE BTN */
.delete-btn { background: none; border: none; cursor: pointer; color: var(--danger); font-size: .8rem; padding: .2rem .5rem; border-radius: 4px; }
.delete-btn:hover { background: rgba(232,138,138,.12); }

/* RESPONSIVE */
@media (max-width: 640px) {
    .form-row { grid-template-columns: 1fr; }
    .vet-card { padding: 2rem 1.5rem; }
    .code-inputs input { width: 56px; height: 64px; font-size: 1.7rem; }
    .animal-header { flex-direction: column; text-align: center; }
    .navbar { padding: 0 1rem; }
}
