/* ====================================================================
   Zeitstempeluhr · Stylesheet
   Minimalistisches Design, responsive für Desktop + Mobil
   ==================================================================== */

:root {
  --bg: #f5f5f0;
  --surface: #ffffff;
  --surface-muted: #faf9f5;
  --border: rgba(0,0,0,0.10);
  --border-strong: rgba(0,0,0,0.20);
  --text: #1a1a1a;
  --text-muted: #666;
  --text-hint: #999;

  --ok-bg:   #e1f5ee; --ok-fg:   #0f6e56; --ok-border:   #1d9e75;
  --info-bg: #e6f1fb; --info-fg: #0c447c; --info-border: #378add;
  --warn-bg: #faeeda; --warn-fg: #854f0b; --warn-border: #ba7517;
  --err-bg:  #fcebeb; --err-fg:  #791f1f; --err-border:  #e24b4a;
  --pro-bg:  #eeedfe; --pro-fg:  #3c3489; --pro-border:  #7f77dd;

  --radius: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--info-fg); text-decoration: none; }
a:hover { text-decoration: underline; }

code, .mono {
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.92em;
}

/* ==================== Top Bar ==================== */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
}
.topbar-inner {
  max-width: 1200px; margin: 0 auto; padding: 0 1.5rem;
  height: 60px;
  display: flex; align-items: center; gap: 1.5rem;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 500; font-size: 16px;
  color: var(--text); text-decoration: none;
  flex-shrink: 0;
}
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--text); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 14px;
}
.brand-mark.big { width: 48px; height: 48px; font-size: 22px; border-radius: 12px; }

.nav {
  display: flex; gap: 2px; flex: 1;
}
.nav a {
  padding: 8px 14px; border-radius: var(--radius);
  color: var(--text-muted); font-size: 14px;
}
.nav a:hover {
  background: var(--surface-muted); color: var(--text);
  text-decoration: none;
}
.nav a.active {
  background: var(--text); color: var(--surface);
}

.user-menu {
  display: flex; align-items: center; gap: 10px; flex-shrink: 0;
}
.user-name { font-size: 14px; color: var(--text-muted); }

/* ==================== Main Layout ==================== */
.main { min-height: calc(100vh - 60px - 80px); padding: 2rem 0; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 1.5rem; }
.container-narrow { max-width: 720px; }

.page-head {
  display: flex; justify-content: space-between; align-items: flex-end;
  gap: 1rem; margin-bottom: 1.5rem; flex-wrap: wrap;
}
.page-head h1 {
  margin: 0; font-size: 26px; font-weight: 500; letter-spacing: -0.3px;
}
.page-head .muted { margin: 4px 0 0; font-size: 14px; }

/* ==================== Cards ==================== */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.5rem;
  margin-bottom: 1.5rem; box-shadow: var(--shadow-sm);
}
.card h2 {
  margin: 0 0 1rem; font-size: 17px; font-weight: 500;
}
.card-pro { border-color: var(--pro-border); background: var(--pro-bg); }
.card-pro h2 { color: var(--pro-fg); }

/* ==================== Clock ==================== */
.clock { text-align: right; }
.clock-time {
  font-size: 32px; font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: 1px; line-height: 1;
}
.clock-date { color: var(--text-muted); font-size: 13px; margin-top: 6px; }

/* ==================== Camera ==================== */
.camera {
  position: relative; width: 100%; aspect-ratio: 4/3;
  background: #111; border-radius: var(--radius-lg);
  overflow: hidden; border: 1px solid var(--border);
}
.camera-sm { aspect-ratio: 4/3; }
#video {
  width: 100%; height: 100%; object-fit: cover;
  transform: scaleX(-1); display: block;
}
#overlay {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  transform: scaleX(-1); pointer-events: none;
}
.cam-ph {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  color: #ddd; text-align: center; padding: 2rem; font-size: 14px;
}
.toast {
  position: absolute; bottom: 16px; left: 16px; right: 16px;
  background: rgba(0,0,0,0.82); color: #fff;
  padding: 11px 16px; border-radius: var(--radius);
  font-size: 14px; text-align: center; font-weight: 500;
  opacity: 0; transition: opacity .3s; pointer-events: none;
}
.toast.show { opacity: 1; }

/* ==================== Panel ==================== */
.panel {
  display: flex; flex-direction: column; gap: 1rem;
}
.label {
  font-size: 11px; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.6px;
  font-weight: 500; margin-bottom: 4px;
}
.who {
  font-size: 26px; font-weight: 500;
  min-height: 34px; word-break: break-word; line-height: 1.2;
}
.status {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--text-muted); margin-top: 6px;
}
.dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--text-hint); flex-shrink: 0;
}
.dot.ok   { background: var(--ok-border); }
.dot.warn { background: var(--warn-border); }
.dot.err  { background: var(--err-border); }

.panel-foot {
  margin-top: auto; padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 13px; color: var(--text-muted);
}

/* ==================== Grid ==================== */
.grid-2 {
  display: grid; grid-template-columns: 1.3fr 1fr;
  gap: 1.5rem; margin-bottom: 1.5rem;
}
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

@media (max-width: 780px) {
  .grid-2 { grid-template-columns: 1fr; }
  .topbar-inner { padding: 0 1rem; gap: 0.5rem; }
  .nav { gap: 0; overflow-x: auto; }
  .nav a { padding: 8px 10px; font-size: 13px; white-space: nowrap; }
  .user-name { display: none; }
  .page-head h1 { font-size: 22px; }
  .clock-time { font-size: 26px; }
}

/* ==================== Buttons ==================== */
.btn {
  display: inline-block;
  padding: 11px 18px; font-size: 14px; font-weight: 500;
  font-family: inherit; line-height: 1.2;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: transparent; color: var(--text);
  cursor: pointer; text-decoration: none;
  transition: background .15s, transform .05s, border-color .15s;
}
.btn:hover:not(:disabled) {
  background: var(--surface-muted); text-decoration: none;
}
.btn:active:not(:disabled) { transform: scale(0.98); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-primary {
  background: var(--text); border-color: var(--text); color: var(--surface);
}
.btn-primary:hover:not(:disabled) { background: #333; }

.btn-block { display: block; width: 100%; text-align: center; }

.btn-in {
  background: var(--ok-bg); border-color: var(--ok-border); color: var(--ok-fg);
  padding: 14px; font-size: 15px;
}
.btn-in:hover:not(:disabled) { background: #d0ebdf; }
.btn-out {
  background: var(--info-bg); border-color: var(--info-border); color: var(--info-fg);
  padding: 14px; font-size: 15px;
}
.btn-out:hover:not(:disabled) { background: #d0e2f2; }

.btn-ghost {
  padding: 6px 10px; font-size: 13px; color: var(--text-muted);
  border: 1px solid var(--border); border-radius: var(--radius);
  text-decoration: none;
}
.btn-ghost:hover { background: var(--surface-muted); text-decoration: none; }

.btn-link {
  background: none; border: none; padding: 4px 8px;
  color: var(--info-fg); font-size: 13px; cursor: pointer;
  font-family: inherit; text-decoration: none;
  border-radius: 4px;
}
.btn-link:hover { background: var(--info-bg); text-decoration: none; }
.btn-link.btn-danger { color: var(--err-fg); }
.btn-link.btn-danger:hover { background: var(--err-bg); }

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

/* ==================== Forms ==================== */
.form { display: flex; flex-direction: column; gap: 14px; }
.form label { display: flex; flex-direction: column; gap: 6px; }
.form label > span {
  font-size: 13px; color: var(--text-muted); font-weight: 500;
}
.form label > span small { color: var(--text-hint); font-weight: 400; }
.form input,
.form select,
.form textarea {
  padding: 10px 12px; font-size: 14px; font-family: inherit;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface); color: var(--text);
}
.form input:focus,
.form select:focus,
.form textarea:focus {
  outline: 2px solid var(--info-border); outline-offset: -1px;
}
.form-inline { flex-direction: row; align-items: flex-end; flex-wrap: wrap; }

.reg-msg { font-size: 13px; color: var(--text-muted); padding: 8px 0; }
.reg-msg.err { color: var(--err-fg); }
.reg-msg.ok { color: var(--ok-fg); }

/* ==================== Tables ==================== */
.table {
  width: 100%; border-collapse: collapse; font-size: 14px;
}
.table th {
  text-align: left; font-weight: 500; color: var(--text-muted);
  padding: 12px 14px; border-bottom: 1px solid var(--border);
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px;
  background: var(--surface-muted);
}
.table td {
  padding: 12px 14px; border-bottom: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}
.table tr:last-child td { border-bottom: none; }
.table .col-action { text-align: right; width: 1%; white-space: nowrap; }
.action-group { display: flex; gap: 4px; justify-content: flex-end; flex-wrap: wrap; }

@media (max-width: 780px) {
  .table th, .table td { padding: 10px 8px; font-size: 13px; }
  .action-group { flex-direction: column; align-items: flex-end; gap: 2px; }
}

/* ==================== Badges ==================== */
.badge {
  display: inline-block; font-size: 11px;
  padding: 3px 10px; border-radius: var(--radius);
  font-weight: 500; letter-spacing: 0.3px;
}
.badge-in    { background: var(--ok-bg);   color: var(--ok-fg); }
.badge-out   { background: var(--info-bg); color: var(--info-fg); }
.badge-free  { background: var(--surface-muted); color: var(--text-muted);
               border: 1px solid var(--border); }
.badge-pro   { background: var(--pro-bg); color: var(--pro-fg); }
.badge-admin { background: var(--warn-bg); color: var(--warn-fg); }

/* ==================== Callouts / Flashes ==================== */
.flash-wrap { max-width: 1200px; margin: 1rem auto 0; padding: 0 1.5rem; }
.flash, .callout {
  padding: 12px 16px; border-radius: var(--radius);
  margin-bottom: 1rem; font-size: 14px;
}
.flash-success, .callout-success {
  background: var(--ok-bg); color: var(--ok-fg);
  border-left: 3px solid var(--ok-border);
}
.flash-error, .callout-error {
  background: var(--err-bg); color: var(--err-fg);
  border-left: 3px solid var(--err-border);
}
.flash-info, .callout-info {
  background: var(--info-bg); color: var(--info-fg);
  border-left: 3px solid var(--info-border);
}
.flash-warn, .callout-warn, .callout-warning {
  background: var(--warn-bg); color: var(--warn-fg);
  border-left: 3px solid var(--warn-border);
}

/* ==================== Empty State ==================== */
.empty-state {
  padding: 3rem 1rem; text-align: center;
  color: var(--text-hint); font-style: italic;
}

/* ==================== Filter Bar ==================== */
.filter-bar {
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
  margin-bottom: 1rem; font-size: 13px; color: var(--text-muted);
}
.filter-bar select {
  padding: 6px 10px; font-size: 13px; font-family: inherit;
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  background: var(--surface); color: var(--text);
}

/* ==================== Stats (Admin) ==================== */
.stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px; margin-bottom: 1.5rem;
}
.stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1rem 1.25rem;
  box-shadow: var(--shadow-sm);
}
.stat-n {
  font-size: 26px; font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.stat-l {
  font-size: 12px; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.5px;
  margin-top: 2px;
}

/* ==================== Plans (Upgrade) ==================== */
.plans {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 1rem; margin-bottom: 1.5rem;
}
@media (max-width: 640px) { .plans { grid-template-columns: 1fr; } }
.plan {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}
.plan-pro { border: 2px solid var(--pro-border); }
.plan-title { font-size: 14px; color: var(--text-muted); font-weight: 500; }
.plan-price {
  font-size: 32px; font-weight: 500; margin: 6px 0 1rem;
  letter-spacing: -0.5px;
}
.plan ul {
  list-style: none; padding: 0; margin: 0 0 1rem;
  font-size: 14px; line-height: 1.8;
}
.plan-current {
  font-size: 12px; color: var(--text-muted);
  padding-top: 1rem; border-top: 1px solid var(--border);
}

/* ==================== Auth Pages ==================== */
.auth-body { background: var(--bg); min-height: 100vh; display: flex; }
.auth-wrap {
  flex: 1; display: flex; align-items: center; justify-content: center;
  padding: 2rem 1rem;
}
.auth-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 2.5rem;
  max-width: 420px; width: 100%;
  box-shadow: 0 4px 24px rgba(0,0,0,0.06);
}
.auth-brand {
  text-align: center; margin-bottom: 1.5rem;
}
.auth-brand .brand-mark { margin: 0 auto 0.75rem; }
.auth-brand h1 {
  margin: 0; font-size: 22px; font-weight: 500;
}
.auth-brand p {
  margin: 4px 0 0; color: var(--text-muted); font-size: 14px;
}
.auth-foot {
  margin-top: 1.5rem; text-align: center;
  font-size: 14px; color: var(--text-muted);
}

/* ==================== Setup Page ==================== */
.setup-wrap {
  min-height: 100vh; display: flex;
  align-items: center; justify-content: center; padding: 2rem 1rem;
  background: var(--bg);
}
.setup-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 2.5rem;
  max-width: 480px; width: 100%; text-align: center;
  box-shadow: 0 4px 24px rgba(0,0,0,0.06);
}
.setup-icon {
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--ok-bg); color: var(--ok-fg);
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; margin: 0 auto 1rem;
}
.setup-card h1 { margin: 0 0 0.5rem; font-size: 22px; font-weight: 500; }
.setup-lead { color: var(--text-muted); margin: 0 0 1.5rem; }
.setup-creds {
  background: var(--surface-muted); border-radius: var(--radius);
  padding: 1rem 1.25rem; margin-bottom: 1rem; text-align: left;
}
.setup-creds > div {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 0;
}
.setup-creds span { font-size: 13px; color: var(--text-muted); }
.setup-creds code {
  background: var(--surface); padding: 4px 10px; border-radius: 4px;
  border: 1px solid var(--border); font-size: 13px;
}
.setup-warn {
  background: var(--warn-bg); color: var(--warn-fg);
  border-radius: var(--radius); padding: 10px 14px;
  font-size: 13px; margin-bottom: 1.5rem; text-align: left;
}

/* ==================== Footer ==================== */
.sitefoot {
  margin-top: 3rem; padding: 1.5rem 0;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.sitefoot-inner {
  max-width: 1200px; margin: 0 auto; padding: 0 1.5rem;
  display: flex; justify-content: space-between;
  font-size: 12px; color: var(--text-hint); flex-wrap: wrap; gap: 0.5rem;
}
