/* ===================================================================
   Workshop Admin — main application stylesheet (screen only).
   Print output uses the dedicated print-*.css files instead.
=================================================================== */

:root {
  --color-bg: #f4f6f8;
  --color-surface: #ffffff;
  --color-border: #e2e5e9;
  --color-text: #1f2933;
  --color-text-muted: #6b7280;
  --color-primary: #2563eb;
  --color-primary-dark: #1d4ed8;
  --color-danger: #dc2626;
  --color-success: #16a34a;
  --color-warning: #d97706;
  --sidebar-width: 240px;
  --radius: 8px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--color-bg); color: var(--color-text); font-size: 14px; }
a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- layout shell ---------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-width);
  background: #111827;
  color: #d1d5db;
  flex-shrink: 0;
  padding: 16px 0;
}
.sidebar .brand { padding: 0 20px 16px; font-weight: 700; font-size: 18px; color: #fff; border-bottom: 1px solid #1f2937; margin-bottom: 8px; }
.sidebar .nav-group-label { padding: 12px 20px 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: #6b7280; }
.sidebar a { display: block; padding: 8px 20px; color: #d1d5db; }
.sidebar a:hover { background: #1f2937; text-decoration: none; }
.sidebar a.active { background: var(--color-primary); color: #fff; }

.main { flex: 1; min-width: 0; }

.topbar {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.topbar .user-info { display: flex; align-items: center; gap: 10px; }
.topbar .user-info .avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--color-primary);
  color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 600;
}
.topbar .user-info .name { font-weight: 600; }
.topbar .user-info .role { font-size: 12px; color: var(--color-text-muted); }

.content { padding: 24px; }

/* ---------- generic components ---------- */
.card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 20px; margin-bottom: 20px; }
.card h2, .card h3 { margin-top: 0; }

.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.page-header h1 { margin: 0; font-size: 22px; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--color-border); }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--color-text-muted); }
tr:hover td { background: #fafbfc; }

.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge-success { background: #dcfce7; color: #166534; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-muted { background: #f3f4f6; color: #4b5563; }

.btn { display: inline-block; padding: 8px 16px; border-radius: 6px; border: 1px solid transparent; font-size: 14px; cursor: pointer; font-weight: 600; }
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--color-primary); color: #fff; }
.btn-primary:hover { background: var(--color-primary-dark); }
.btn-secondary { background: #fff; color: var(--color-text); border-color: var(--color-border); }
.btn-danger { background: var(--color-danger); color: #fff; }
.btn-success { background: var(--color-success); color: #fff; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-block { width: 100%; }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

form label { display: block; margin: 12px 0 4px; font-weight: 600; font-size: 13px; }
form input[type=text], form input[type=password], form input[type=email], form input[type=tel],
form input[type=number], form select, form textarea {
  width: 100%; padding: 9px 10px; border: 1px solid var(--color-border); border-radius: 6px; font-size: 14px;
}
form .form-row { display: flex; gap: 16px; }
form .form-row > * { flex: 1; }
form .hint { font-size: 12px; color: var(--color-text-muted); margin-top: 4px; }
form .checkbox-row { display: flex; align-items: center; gap: 8px; margin: 10px 0; }
form .checkbox-row input { width: auto; }

.alert { padding: 12px 14px; border-radius: 6px; margin-bottom: 16px; font-size: 13px; }
.alert-error { background: #fee2e2; color: #991b1b; }
.alert-success { background: #dcfce7; color: #166534; }
.alert-info { background: #dbeafe; color: #1e40af; }

.perm-matrix { width: 100%; border-collapse: collapse; }
.perm-matrix th, .perm-matrix td { text-align: center; }
.perm-matrix td:first-child, .perm-matrix th:first-child { text-align: left; }
.perm-matrix .group-row td { background: #f3f4f6; font-weight: 700; text-align: left; }

/* ---------- auth pages ---------- */
.auth-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.auth-card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 32px; width: 340px; }
.auth-card h1 { margin: 0 0 4px; font-size: 20px; }
.auth-subtitle { color: var(--color-text-muted); margin: 0 0 16px; font-size: 13px; }

.error-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.error-card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 32px; max-width: 420px; text-align: center; }

/* ---------- invoice screen preview + action bar ---------- */
.invoice-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.invoice-preview-frame { width: 100%; height: 80vh; border: 1px solid var(--color-border); border-radius: var(--radius); background: #fff; }
