:root {
    --orange: #f29a24;
    --orange-bright: #ffad3d;
    --orange-dark: #c66e0e;
    --black: #0e0e0e;
    --charcoal: #1a1a1a;
    --charcoal-2: #252525;
    --charcoal-3: #303030;
    --border: #d7d7d7;
    --border-dark: #3a3a3a;
    --muted: #6d6d6d;
    --light: #f4f5f7;
    --white: #ffffff;
    --danger: #a71d2a;
    --success: #176b36;
    --shadow-soft: 0 8px 28px rgba(0, 0, 0, 0.08);
    --shadow-card: 0 10px 24px rgba(0, 0, 0, 0.10);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    color: var(--black);
    background: linear-gradient(180deg, #f6f7f9 0%, #eef0f3 100%);
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.5;
}

img {
    max-width: 100%;
}

a {
    color: var(--orange-dark);
}

/* HEADER */

.admin-header {
    color: var(--white);
    background: linear-gradient(180deg, #151515 0%, #0b0b0b 100%);
    border-bottom: 3px solid var(--orange);
    box-shadow: 0 5px 18px rgba(0, 0, 0, 0.28);
}

.admin-header__inner {
    width: min(1280px, calc(100% - 36px));
    min-height: 92px;
    margin: 0 auto;
    padding: 14px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.admin-brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    color: var(--white);
    text-decoration: none;
    font-size: 1.12rem;
    font-weight: 900;
}

.admin-brand:hover,
.admin-brand:focus {
    color: var(--orange-bright);
}

.admin-logo {
    display: block;
    width: 120px;
    height: auto;
}

/* NAVIGATION */

.admin-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 9px;
}

.admin-nav a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 9px 14px;
    color: #f5f5f5;
    background: var(--charcoal-2);
    border: 1px solid #3d3d3d;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.91rem;
    font-weight: 800;
    transition: 0.15s ease;
}

.admin-nav a:hover,
.admin-nav a:focus {
    color: var(--black);
    background: var(--orange);
    border-color: var(--orange);
    transform: translateY(-1px);
}

.admin-nav a:last-child {
    color: #f2cccc;
    background: #29191b;
    border-color: #563034;
}

.admin-nav a:last-child:hover,
.admin-nav a:last-child:focus {
    color: var(--white);
    background: #8d1f29;
    border-color: #8d1f29;
}

/* MAIN */

.admin-main {
    width: min(1280px, calc(100% - 36px));
    min-height: calc(100vh - 172px);
    margin: 0 auto;
    padding: 38px 0 70px;
}

.admin-footer {
    min-height: 76px;
    display: grid;
    place-items: center;
    padding: 18px;
    color: #aaaaaa;
    background: var(--black);
    border-top: 1px solid #2f2f2f;
    text-align: center;
}

h1 {
    margin: 0 0 8px;
    color: #151515;
    font-size: clamp(2rem, 4vw, 2.7rem);
    line-height: 1.15;
}

h2 {
    margin-top: 0;
    color: #1b1b1b;
}

h3 {
    color: #222222;
}

.page-intro {
    max-width: 900px;
    margin-top: 0;
    margin-bottom: 20px;
    color: var(--muted);
}

/* CARDS */

.card,
.form-card,
.table-card,
.login-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow-soft);
}

.form-card,
.table-card {
    padding: 26px;
    margin-top: 26px;
}

.login-wrap {
    min-height: 66vh;
    display: grid;
    place-items: center;
}

.login-card {
    width: min(500px, 100%);
    padding: 34px;
}

/* DASHBOARD STATS */

.stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-top: 28px;
}

.stat {
    min-height: 112px;
    padding: 19px 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    color: var(--white);
    background: linear-gradient(145deg, #262626 0%, #151515 100%);
    border: 1px solid #353535;
    border-left: 4px solid var(--orange);
    border-radius: 12px;
    box-shadow: var(--shadow-card);
}

.stat__number {
    display: block;
    margin-bottom: 4px;
    color: var(--orange);
    font-size: 2rem;
    line-height: 1;
    font-weight: 900;
}

/* DASHBOARD CARDS */

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    margin-top: 28px;
}

.dashboard-card {
    position: relative;
    min-height: 175px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 18px;
    color: var(--black);
    background: var(--white);
    border: 1px solid var(--border);
    border-top: 4px solid var(--orange);
    border-radius: 14px;
    box-shadow: var(--shadow-card);
    text-decoration: none;
    overflow: hidden;
    transition: 0.16s ease;
}

.dashboard-card::after {
    position: absolute;
    right: 18px;
    bottom: 14px;
    content: "→";
    color: var(--orange);
    font-size: 1.55rem;
    font-weight: 900;
}

.dashboard-card:hover,
.dashboard-card:focus {
    transform: translateY(-4px);
    border-top-color: var(--orange-bright);
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.13);
}

.dashboard-card strong {
    display: block;
    padding-right: 28px;
    color: #191919;
    font-size: 1.3rem;
    line-height: 1.2;
}

.dashboard-card span {
    display: block;
    padding-right: 28px;
    color: var(--muted);
    font-size: 0.95rem;
    line-height: 1.5;
}

/* FORMS */

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 19px;
}

.form-grid--three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.field {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.field--full {
    grid-column: 1 / -1;
}

label {
    color: #222222;
    font-weight: 800;
}

.hint {
    color: var(--muted);
    font-size: 0.85rem;
}

input,
select,
textarea {
    width: 100%;
    min-height: 46px;
    padding: 11px 12px;
    color: var(--black);
    background: var(--white);
    border: 1px solid #b8b8b8;
    border-radius: 8px;
    font: inherit;
}

textarea {
    min-height: 118px;
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--orange);
    box-shadow: 0 0 0 3px rgba(242, 154, 36, 0.18);
}

.checkbox-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    padding: 15px;
    background: #fafafa;
    border: 1px solid var(--border);
    border-radius: 9px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: var(--white);
    border: 1px solid #e0e0e0;
    border-radius: 7px;
}

.checkbox-item input {
    width: auto;
    min-height: 0;
}

/* BUTTONS */

.button,
button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 11px 18px;
    color: var(--black);
    background: var(--orange);
    border: 1px solid var(--orange);
    border-radius: 8px;
    cursor: pointer;
    font: inherit;
    font-weight: 900;
    text-decoration: none;
}

.button:hover,
button:hover,
.button:focus,
button:focus {
    background: var(--orange-bright);
    border-color: var(--orange-bright);
}

.button--secondary {
    color: var(--white);
    background: var(--charcoal);
    border-color: var(--charcoal);
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 11px;
    margin-top: 22px;
}

/* MESSAGES */

.flash,
.errors {
    padding: 15px 17px;
    margin-bottom: 24px;
    border-radius: 9px;
}

.flash--success {
    color: #0f4b27;
    background: #dff4e6;
    border: 1px solid #8bc5a1;
}

.flash--error,
.errors {
    color: #721c24;
    background: #f8d7da;
    border: 1px solid #e2a4aa;
}

/* TABLES */

.table-scroll {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 10px;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
}

th,
td {
    padding: 13px 12px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
}

th {
    color: #373737;
    background: #f0f1f3;
    font-size: 0.82rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.045em;
}

tbody tr:hover {
    background: #fffaf3;
}

.saved-animal-row {
    cursor: pointer;
}

.saved-animal-row:focus {
    outline: 3px solid rgba(242, 154, 36, 0.45);
    outline-offset: -3px;
}

td a {
    display: inline-flex;
    padding: 5px 9px;
    color: #3e2a13;
    background: #fff1dc;
    border: 1px solid #f1c98d;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 800;
    font-size: 0.86rem;
}

td a:hover,
td a:focus {
    color: var(--black);
    background: var(--orange);
    border-color: var(--orange);
}

.empty {
    padding: 28px;
    color: var(--muted);
    text-align: center;
}

/* LICENSE PLATE */

.plate {
    display: inline-block;
    padding: 5px 9px;
    color: var(--white);
    background: var(--black);
    border: 2px solid var(--orange);
    border-radius: 6px;
    font-family: Consolas, "Courier New", monospace;
    font-weight: 900;
    letter-spacing: 0.08em;
}

/* INDIVIDUAL ANIMAL */

.animal-profile-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 22px;
}

.animal-profile-back {
    display: inline-block;
    margin-bottom: 12px;
    font-weight: 800;
    text-decoration: none;
}

.animal-profile-heading .page-intro {
    margin-bottom: 0;
}

.animal-profile-tag-preview {
    margin-top: 26px;
    padding: 26px;
    overflow-x: auto;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow-soft);
}

.animal-profile-tag-preview .animal-tag-print-area {
    margin-top: 0;
}

.animal-profile-tag-preview .animal-tag-print-page {
    margin-bottom: 0;
}

/* FEEDING IDENTIFICATION */

.feeding-sex {
    display: inline-block;
    min-width: 70px;
    padding: 4px 9px;
    border: 1px solid currentColor;
    border-radius: 999px;
    background: #fff;
    text-align: center;
    font-size: 0.78rem;
    font-weight: 900;
}

.feeding-sex--female {
    color: #b33658;
    background: #fff0f4;
}

.feeding-sex--male {
    color: #2866a7;
    background: #edf5ff;
}

.feeding-sex--unknown {
    color: #555;
    background: #f1f1f1;
}

.feeding-traits {
    display: flex;
    min-width: 170px;
    max-width: 330px;
    flex-wrap: wrap;
    gap: 5px;
}

.feeding-trait {
    display: inline-block;
    max-width: 220px;
    padding: 3px 8px;
    overflow: hidden;
    border: 1px solid #222;
    border-radius: 999px;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.72rem;
    font-weight: 800;
    line-height: 1.15;
}

.feeding-trait--visual {
    color: #000;
    background: #56b4e9;
    border-color: #2e7fae;
}

.feeding-trait--het {
    color: #000;
    background: #e69f00;
    border-color: #9a6a00;
}

.feeding-trait--possible {
    color: #000;
    background: #cc79a7;
    border-color: #8a4d70;
}

.feeding-trait--super {
    color: #fff;
    background: #009e73;
    border-color: #006b4e;
}

.feeding-trait--phase {
    color: #fff;
    background: #0072b2;
    border-color: #004c78;
}

/* CARE CALENDAR */
.calendar-heading,
.calendar-toolbar,
.calendar-summary { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.calendar-heading .page-intro { margin-bottom: 0; }
.calendar-toolbar { margin-top: 28px; padding: 16px; background: var(--white); border: 1px solid var(--border); border-radius: 12px 12px 0 0; }
.calendar-toolbar h2 { margin: 0; }
.calendar-summary { justify-content: flex-start; flex-wrap: wrap; padding: 12px 16px; color: #4f4f4f; background: #fff8ed; border: 1px solid #efd2a8; border-top: 0; }
.calendar { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); background: var(--border); border: 1px solid var(--border); border-top: 0; gap: 1px; }
.calendar__weekday { padding: 10px 8px; color: var(--white); background: var(--charcoal); text-align: center; font-size: .8rem; font-weight: 900; text-transform: uppercase; }
.calendar__day { min-width: 0; min-height: 150px; padding: 9px; background: var(--white); }
.calendar__day--outside { background: #f1f2f4; }
.calendar__day--outside .calendar__date,
.calendar__day--outside .calendar-event { opacity: .58; }
.calendar__day--today { box-shadow: inset 0 0 0 3px var(--orange); }
.calendar__date { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; font-weight: 900; }
.calendar__date span { color: var(--orange-dark); font-size: .7rem; text-transform: uppercase; }
.calendar__events { display: grid; gap: 6px; }
.calendar-event { display: block; width: 100%; min-width: 0; padding: 7px 8px; color: #2f210e; background: #fff0d8; border: 0; border-left: 4px solid var(--orange); border-radius: 5px; font: inherit; text-align: left; text-decoration: none; overflow-wrap: anywhere; }
button.calendar-event { cursor: pointer; }
.calendar-event:hover,
.calendar-event:focus { color: var(--black); background: #ffdca8; }
.calendar-event--due { color: #6b3300; background: #fff0d8; border-left-color: var(--orange); }
.calendar-event--complete { color: #173c2b; background: #e5f5eb; border-left-color: var(--success); }
.calendar-event--complete:hover,
.calendar-event--complete:focus { color: #0b2b1c; background: #cdebd8; }
.calendar-event--show { color: #173c2b; background: #e5f5eb; border-left-color: var(--success); }
.calendar-event--show:hover,
.calendar-event--show:focus { color: #0b2b1c; background: #cdebd8; }
.calendar-event strong,
.calendar-event span,
.calendar-event small { display: block; }
.calendar-event span,
.calendar-event small { margin-top: 2px; font-size: .72rem; line-height: 1.3; }
.calendar-footnote { color: var(--muted); font-size: .9rem; }
.calendar-dialog { width: min(560px, calc(100% - 32px)); max-width: none; padding: 0; color: var(--black); background: var(--white); border: 0; border-radius: 14px; box-shadow: 0 24px 70px rgba(0, 0, 0, .32); }
.calendar-dialog::backdrop { background: rgba(20, 20, 20, .62); }
.calendar-dialog__card { position: relative; padding: 30px; }
.calendar-dialog__close-form { position: absolute; top: 12px; right: 12px; }
.calendar-dialog__close { width: 36px; height: 36px; padding: 0; color: var(--muted); background: transparent; border: 0; border-radius: 50%; font-size: 1.8rem; line-height: 1; cursor: pointer; }
.calendar-dialog__close:hover,
.calendar-dialog__close:focus { color: var(--black); background: #f0f0f0; }
.calendar-dialog__eyebrow { color: var(--success); font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.calendar-dialog h2 { margin: 6px 40px 20px 0; }
.calendar-dialog__details { display: grid; gap: 12px; margin: 0; }
.calendar-dialog__details div { padding: 13px 15px; background: #f7f7f7; border-radius: 8px; }
.calendar-dialog__details dt { color: var(--muted); font-size: .72rem; font-weight: 900; letter-spacing: .06em; text-transform: uppercase; }
.calendar-dialog__details dd { margin: 4px 0 0; line-height: 1.45; }
.calendar-dialog__actions { display: flex; justify-content: flex-end; margin-top: 22px; }

/* DAILY TASKS */
.daily-task-date { text-align: center; }
.daily-task-date h2 { margin-bottom: 2px; }
.daily-progress { padding: 18px 20px; color: var(--white); background: var(--charcoal); }
.daily-progress__track { height: 9px; margin-top: 10px; background: #454545; border-radius: 999px; overflow: hidden; }
.daily-progress__track span { display: block; height: 100%; background: var(--orange); border-radius: inherit; }
.daily-view-note { margin: 16px 0 0; padding: 12px 16px; color: #60451e; background: #fff8ed; border: 1px solid #efd2a8; border-radius: 8px; }
.daily-task-section { margin-top: 28px; }
.daily-section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; }
.daily-section-heading h2 { margin-bottom: 3px; }
.daily-section-heading p { margin: 0; color: var(--muted); }
.daily-thaw-list { margin-top: 16px; padding: 18px 20px; background: #edf6fc; border: 1px solid #b8d7ec; border-radius: 10px; }
.daily-thaw-list h3 { margin-bottom: 3px; }
.daily-thaw-list p { margin: 0 0 14px; color: var(--muted); }
.daily-thaw-list .table-scroll { background: var(--white); border-radius: 8px; }
.daily-thaw-list__short { color: #a71d2a; font-weight: 900; }
.daily-scheduled { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-top: 22px; padding: 18px 20px; background: #fff0d8; border: 1px solid #efc17e; border-left: 5px solid var(--orange); border-radius: 10px; }
.daily-scheduled strong,
.daily-scheduled span { display: block; }
.daily-scheduled strong { font-size: 1.08rem; }
.daily-scheduled span { color: var(--muted); }
.daily-checklist { display: grid; gap: 12px; margin-top: 22px; }
.daily-task { background: var(--white); border: 1px solid var(--border); border-left: 5px solid var(--orange); border-radius: 10px; box-shadow: var(--shadow-soft); }
.daily-task label { display: flex; align-items: flex-start; gap: 15px; padding: 18px 20px; cursor: pointer; }
.daily-task input[type="checkbox"] { width: 24px; min-height: 24px; margin-top: 2px; flex: 0 0 auto; accent-color: var(--success); }
.daily-task__body { display: block; }
.daily-task__body small,
.daily-task__body strong,
.daily-task__body span,
.daily-task__body em { display: block; }
.daily-task__body small { color: var(--orange-dark); font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; }
.daily-task__body strong { margin-top: 2px; font-size: 1.08rem; }
.daily-task__body span { margin-top: 5px; color: var(--muted); font-weight: 400; }
.daily-task__body em { margin-top: 6px; color: var(--success); font-size: .78rem; font-weight: 400; }
.daily-task__body .daily-task__schedule { color: #4f4f4f; font-size: .8rem; }
.daily-task__schedule b { color: #a83422; }
.daily-task__feeding-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 18px 20px; }
.daily-task__feeding-row .daily-task__body { min-width: 0; flex: 1 1 auto; }
.daily-task__feeding-row form { flex: 0 0 auto; }
.daily-task__feeding-actions { display: grid; flex: 0 0 auto; justify-items: stretch; gap: 8px; text-align: center; }
.daily-task__feeding-actions a { font-size: .84rem; font-weight: 800; }
.daily-task__complete-mark { display: grid; width: 26px; height: 26px; flex: 0 0 26px; place-items: center; color: var(--white); background: var(--success); border-radius: 50%; font-weight: 900; }
.daily-task__due-label { flex: 0 0 auto; padding: 6px 10px; color: #704100; background: #fff0d8; border-radius: 999px; font-size: .78rem; font-weight: 900; }
.daily-task--feeding { border-left-color: #2670a8; }
.daily-task--overdue { border-left-color: #bd3e2a; }
.daily-task--complete { border-left-color: var(--success); background: #f1faf4; }
.daily-task--complete .daily-task__body strong { color: #667069; text-decoration: line-through; }

/* RESPONSIVE */

@media (max-width: 1050px) {
    .admin-header__inner {
        flex-direction: column;
        align-items: stretch;
        padding: 16px 0;
    }

    .admin-brand,
    .admin-nav {
        justify-content: center;
    }

    .dashboard-grid,
    .stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .form-grid--three,
    .checkbox-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 680px) {
    .admin-header__inner,
    .admin-main {
        width: min(100% - 24px, 1280px);
    }

    .admin-nav {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        width: 100%;
        gap: 8px;
    }

    .admin-nav a {
        width: 100%;
    }

    .dashboard-grid,
    .stats,
    .form-grid,
    .form-grid--three,
    .checkbox-list {
        grid-template-columns: 1fr;
    }

    .form-card,
    .table-card,
    .login-card {
        padding: 20px;
    }

    .actions {
        flex-direction: column;
    }

    .actions .button,
    .actions button {
        width: 100%;
    }

    .calendar-heading,
    .calendar-toolbar { align-items: stretch; flex-direction: column; text-align: center; }
    .animal-profile-heading { align-items: stretch; flex-direction: column; }
    .animal-profile-heading .button { width: 100%; }
    .calendar { display: block; background: transparent; border: 0; }
    .calendar__weekday,
    .calendar__day--outside { display: none; }
    .calendar__day { min-height: 82px; margin-bottom: 10px; border: 1px solid var(--border); border-radius: 9px; }
    .daily-scheduled { align-items: stretch; flex-direction: column; }
    .daily-section-heading,
    .daily-task__feeding-row { align-items: stretch; flex-direction: column; }
    .daily-task__feeding-row form button,
    .daily-task__feeding-actions { width: 100%; }
}
