:root {
  --bg: #0f0d0b;
  --surface: #1a1714;
  --surface2: #252118;
  --border: #2e2820;
  --gold: #d4a843;
  --gold-light: #e8c56a;
  --gold-dim: #8a6c28;
  --cream: #f5ede0;
  --cream-dim: #a89880;
  --green: #4caf7d;
  --red: #e05c5c;
  --blue: #5b9bd5;
  --text: #f0e8dc;
  --text-dim: #7a6e64;
  --radius: 16px;
  --radius-sm: 10px;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 20% 0%, rgba(212,168,67,0.07) 0%, transparent 60%),
    radial-gradient(ellipse 60% 80% at 80% 100%, rgba(212,168,67,0.04) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

a { color: inherit; text-decoration: none; }

.app { position: relative; z-index: 1; max-width: 1200px; margin: 0 auto; padding: 24px 20px; }

/* HEADER */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 0 32px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 36px;
  gap: 20px;
  flex-wrap: wrap;
}

.logo { display: flex; align-items: center; gap: 14px; }

.logo-icon {
  width: 52px; height: 52px;
  background: linear-gradient(135deg, var(--gold), var(--gold-dim));
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px;
  box-shadow: 0 4px 20px rgba(212,168,67,0.3);
}

.logo-text h1 {
  font-family: 'Playfair Display', serif;
  font-size: 26px;
  font-weight: 900;
  color: var(--gold-light);
  letter-spacing: -0.5px;
}

.logo-text p {
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-top: 1px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 18px;
}

.header-time { text-align: right; }

.header-time .clock {
  font-family: 'DM Mono', monospace;
  font-size: 22px;
  color: var(--gold);
  letter-spacing: 1px;
}

.header-time .date {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 2px;
}

.header-user {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--text-dim);
}

.header-user strong { color: var(--cream); font-weight: 600; }

.logout-form { display: inline; }

.logout-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.logout-btn:hover { color: var(--text); border-color: var(--text-dim); }

/* TABS */
.tabs {
  display: flex;
  gap: 4px;
  background: var(--surface);
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 32px;
  border: 1px solid var(--border);
}

.tab-btn {
  flex: 1;
  padding: 11px 16px;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--text-dim);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.3px;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.tab-btn.active {
  background: var(--gold);
  color: #1a1200;
  font-weight: 600;
  box-shadow: 0 2px 12px rgba(212,168,67,0.35);
}

.tab-btn:hover:not(.active) {
  color: var(--text);
  background: var(--surface2);
}

/* SECTIONS */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.section-title {
  font-family: 'Playfair Display', serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--cream);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  font-family: 'DM Mono', monospace;
}

.badge-green { background: rgba(76,175,125,0.15); color: var(--green); border: 1px solid rgba(76,175,125,0.25); }
.badge-gold  { background: rgba(212,168,67,0.15); color: var(--gold); border: 1px solid rgba(212,168,67,0.25); }
.badge-red   { background: rgba(224,92,92,0.15); color: var(--red); border: 1px solid rgba(224,92,92,0.25); }

/* DOG CARDS */
.dogs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.dog-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: all 0.25s;
  position: relative;
  color: inherit;
  display: block;
  width: 100%;
  text-align: left;
  font-family: inherit;
  padding: 0;
}

button.dog-card { outline: none; }
button.dog-card:focus-visible { border-color: var(--gold); }

.dog-card:hover {
  border-color: var(--gold-dim);
  transform: translateY(-3px);
  box-shadow: 0 8px 28px rgba(0,0,0,0.4), 0 0 0 1px rgba(212,168,67,0.2);
}

.dog-card.inside {
  border-color: rgba(76,175,125,0.35);
  box-shadow: 0 0 0 1px rgba(76,175,125,0.15);
}

.dog-card.inside:hover {
  border-color: var(--green);
  box-shadow: 0 8px 28px rgba(0,0,0,0.4), 0 0 0 1px rgba(76,175,125,0.4);
}

.dog-avatar {
  width: 100%;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 64px;
  background: var(--surface2);
  position: relative;
}

.dog-status-dot {
  position: absolute;
  top: 10px; right: 10px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--text-dim);
  border: 2px solid var(--surface);
}

.dog-card.inside .dog-status-dot {
  background: var(--green);
  box-shadow: 0 0 8px rgba(76,175,125,0.6);
}

.dog-info { padding: 14px; }

.dog-name {
  font-weight: 700;
  font-size: 15px;
  color: var(--cream);
  margin-bottom: 2px;
}

.dog-owner {
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.dog-timer {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--green);
  display: none;
}

.dog-card.inside .dog-timer { display: block; }

.dog-action-hint {
  font-size: 11px;
  color: var(--gold-dim);
  font-weight: 500;
}

.dog-card.inside .dog-action-hint { color: rgba(224,92,92,0.7); }

/* CARDS / FORMS */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 24px;
}

.card-title {
  font-family: 'Playfair Display', serif;
  font-size: 17px;
  font-weight: 700;
  color: var(--cream);
  margin-bottom: 20px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
  margin-bottom: 18px;
}

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

@media (max-width: 600px) {
  .form-grid,
  .form-grid.two { grid-template-columns: 1fr; }
  .dogs-grid { grid-template-columns: repeat(2, 1fr); }
}

.form-group label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 7px;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 10px 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.form-group input:focus, .form-group select:focus { border-color: var(--gold-dim); }
.form-group select option { background: var(--surface2); }

.emoji-picker {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.emoji-opt {
  width: 38px; height: 38px;
  border-radius: 8px;
  background: var(--surface2);
  border: 2px solid var(--border);
  font-size: 20px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}

.emoji-opt:hover { border-color: var(--gold-dim); transform: scale(1.1); }
.emoji-opt.selected { border-color: var(--gold); background: rgba(212,168,67,0.1); }

.btn {
  padding: 11px 22px;
  border-radius: var(--radius-sm);
  border: none;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex; align-items: center; gap: 7px;
}

.btn-primary {
  background: var(--gold);
  color: #1a1200;
  box-shadow: 0 2px 12px rgba(212,168,67,0.3);
}

.btn-primary:hover {
  background: var(--gold-light);
  box-shadow: 0 4px 20px rgba(212,168,67,0.45);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
}

.btn-outline:hover { border-color: var(--text-dim); color: var(--text); }

.btn-danger {
  background: rgba(224,92,92,0.15);
  color: var(--red);
  border: 1px solid rgba(224,92,92,0.3);
}

.btn-danger:hover { background: rgba(224,92,92,0.25); }

.btn-block { width: 100%; justify-content: center; }

/* MODAL */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(6px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.open { display: flex; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 32px;
  max-width: 520px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  animation: modalIn 0.25s ease;
}

@keyframes modalIn {
  from { transform: scale(0.95) translateY(10px); opacity: 0; }
  to   { transform: scale(1) translateY(0); opacity: 1; }
}

.modal-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.modal-avatar {
  width: 64px; height: 64px;
  border-radius: 14px;
  background: var(--surface2);
  display: flex; align-items: center; justify-content: center;
  font-size: 36px;
}

.modal-dog-name {
  font-family: 'Playfair Display', serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--cream);
}

.modal-owner {
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 2px;
}

.modal-close {
  margin-left: auto;
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text-dim);
  cursor: pointer;
  font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}

.modal-close:hover { color: var(--text); border-color: var(--text-dim); }

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

.info-row:last-of-type { border-bottom: none; }

.info-label { font-size: 12px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.8px; }
.info-value { font-size: 14px; color: var(--text); font-weight: 500; font-family: 'DM Mono', monospace; }
.info-value.highlight { color: var(--gold); font-size: 18px; }

.modal-actions { display: flex; gap: 10px; margin-top: 24px; }
.modal-actions form { display: contents; }

/* REPORT */
.report-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 20px;
}

.report-dog-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 22px;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
}

.report-body { padding: 0; }

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

th {
  padding: 10px 16px;
  text-align: left;
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
  background: rgba(255,255,255,0.02);
  border-bottom: 1px solid var(--border);
}

td {
  padding: 12px 16px;
  font-size: 13px;
  border-bottom: 1px solid rgba(46,40,32,0.5);
  font-family: 'DM Mono', monospace;
}

tr:last-child td { border-bottom: none; }

.month-total-row {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 16px;
  margin-bottom: 8px;
}

.month-total-row .label {
  font-size: 12px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.month-total-row .value {
  font-family: 'Playfair Display', serif;
  font-size: 24px;
  color: var(--gold-light);
  font-weight: 700;
}

.month-title {
  font-family: 'Playfair Display', serif;
  font-size: 18px;
  color: var(--gold-light);
  margin: 24px 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

/* TOAST */
.toast-container {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toastIn 0.3s ease;
  max-width: 320px;
}

@keyframes toastIn {
  from { transform: translateX(20px); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}

.toast-success { background: rgba(76,175,125,0.9); color: #fff; }
.toast-error   { background: rgba(224,92,92,0.9);  color: #fff; }
.toast-info    { background: rgba(91,155,213,0.9); color: #fff; }

/* EMPTY */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-dim);
}

.empty-state .icon { font-size: 48px; margin-bottom: 14px; }
.empty-state p { font-size: 14px; }

/* SCROLLBAR */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.print-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  background: rgba(212,168,67,0.1);
  border: 1px solid rgba(212,168,67,0.3);
  color: var(--gold);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}
.print-btn:hover { background: rgba(212,168,67,0.2); }

@media print {
  .tabs, header .header-right, .btn, .print-btn, .tab-btn { display: none !important; }
  body { background: white; color: black; }
  .report-section { border: 1px solid #ccc; }
}

/* LOGIN */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
  z-index: 1;
}

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px 32px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.4);
}

.auth-card .logo {
  justify-content: center;
  margin-bottom: 24px;
}

.auth-card h2 {
  font-family: 'Playfair Display', serif;
  font-size: 22px;
  color: var(--cream);
  text-align: center;
  margin-bottom: 24px;
}

.auth-card .form-group { margin-bottom: 14px; }

.auth-error {
  background: rgba(224,92,92,0.12);
  border: 1px solid rgba(224,92,92,0.3);
  color: var(--red);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 16px;
  text-align: center;
}

/* USERS TABLE */
.users-list {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 24px;
}

.users-list table th,
.users-list table td { padding: 12px 18px; }

.users-list td { font-family: 'DM Sans', sans-serif; }

.users-list .admin-tag {
  display: inline-block;
  padding: 2px 8px;
  background: rgba(212,168,67,0.15);
  color: var(--gold);
  border: 1px solid rgba(212,168,67,0.25);
  border-radius: 12px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-family: 'DM Mono', monospace;
}

.inline-form { display: inline; margin: 0; }

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}
