* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  color: #1f2937;
  background: #f3f4f6;
}

.hidden { display: none !important; }
.muted { color: #6b7280; font-size: .9rem; font-weight: 400; }
.error { color: #b91c1c; min-height: 1.2rem; }
.card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
}

.login {
  max-width: 24rem;
  margin: 12vh auto;
  padding: 2rem;
}
.login h1 { margin: 0 0 .25rem; }
.login form { display: grid; gap: .9rem; margin-top: 1.2rem; }
label { display: grid; gap: .35rem; font-size: .9rem; }

input, select, textarea {
  font: inherit;
  padding: .55rem .65rem;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: #fff;
}

button {
  font: inherit;
  padding: .55rem .9rem;
  border: 1px solid #0f766e;
  border-radius: 8px;
  background: #0f766e;
  color: #fff;
  cursor: pointer;
}
button:hover { background: #115e59; }
button.ghost { background: transparent; color: #0f766e; }
button.danger { border-color: #b91c1c; background: #b91c1c; }
button.small { padding: .3rem .55rem; font-size: .82rem; }

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: .9rem 1.4rem;
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  flex-wrap: wrap;
}
.brand { font-weight: 700; font-size: 1.05rem; }
nav { display: flex; gap: .4rem; flex-wrap: wrap; }
nav button { background: transparent; color: #374151; border-color: transparent; }
nav button.active { background: #e6fffb; color: #0f766e; border-color: #99f6e4; }

main { padding: 1.4rem; max-width: 1200px; margin: 0 auto; }
h2 { margin: 0 0 1rem; }
h3 { margin: 0 0 .75rem; }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1rem; }
.stat { padding: 1rem; }
.stat .value { font-size: 1.7rem; font-weight: 700; }
.stat .label { color: #6b7280; font-size: .85rem; }
.stat.clickable { cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.stat.clickable:hover { border-color: #0f766e; box-shadow: 0 2px 8px rgba(15,118,110,.15); }

.preview {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(17, 24, 39, .94);
  padding: 1rem;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: .6rem;
}
.preview-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #fff;
  gap: 1rem;
}
.preview-title { font-size: .9rem; opacity: .8; }
.preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  border-radius: 6px;
}

table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 10px; overflow: hidden; }
th, td { text-align: left; padding: .6rem .7rem; border-bottom: 1px solid #f3f4f6; font-size: .9rem; }
th { background: #f9fafb; color: #374151; font-weight: 600; }
tr.clickable:hover { background: #f0fdfa; cursor: pointer; }
.link { color: #0f766e; cursor: pointer; }
.link:hover { text-decoration: underline; }
.table-wrap { overflow-x: auto; }

.panel { padding: 1rem; margin-bottom: 1rem; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .8rem; }
.actions { display: flex; gap: .5rem; margin-top: 1rem; flex-wrap: wrap; }
.toolbar { display: flex; gap: .5rem; align-items: end; margin-bottom: 1rem; flex-wrap: wrap; }

.toast {
  position: fixed;
  right: 1.2rem;
  bottom: 1.2rem;
  background: #111827;
  color: #fff;
  padding: .7rem 1rem;
  border-radius: 8px;
  max-width: 24rem;
}
.toast.error { background: #b91c1c; }
