/* ===== Variables ===== */
:root {
  --bg: #fdf4ea;
  --brown-dark: #5a3a1e;
  --brown: #8b4513;
  --brown-hero-1: #7b4e30;
  --brown-hero-2: #5a3a1e;
  --tan: #f2e4d3;
  --text: #4a2c14;
  --muted: #8a7260;
  --white: #fff;
  --shadow: 0 2px 8px rgba(90, 58, 30, .06);
  --radius: 18px;
}

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

body {
  font-family: Arial, Helvetica, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.muted { color: var(--muted); font-size: .95rem; }
[hidden] { display: none !important; }

/* ===== Login ===== */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff6ee;
  padding: 20px;
}
.login-card {
  background: var(--white);
  width: 100%;
  max-width: 545px;
  padding: 50px 35px 35px;
  border-radius: 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, .06);
}
.brand-title {
  text-align: center;
  color: var(--brown);
  font-size: 2.3rem;
  margin-bottom: 22px;
}
.login-card h2 { color: #000; font-size: 1.9rem; margin-bottom: 22px; }
.login-card label { display: block; font-size: 1.15rem; margin-bottom: 8px; color: #111; }
.login-card input {
  width: 100%;
  padding: 15px 16px;
  font-size: 1.05rem;
  background: #e8f0fe;
  border: 1px solid #767676;
  border-radius: 2px;
  margin-bottom: 22px;
}
.login-card input:focus { outline: 2px solid var(--brown); }
.btn-login {
  width: 100%;
  padding: 16px;
  background: var(--brown);
  color: #fff;
  border: 0;
  border-radius: 6px;
  font-size: 1.05rem;
  cursor: pointer;
  transition: background .2s;
}
.btn-login:hover { background: #6f360f; }
.form-error {
  background: #fde8e8;
  color: #a12020;
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 18px;
  font-size: .95rem;
}

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

.sidebar {
  width: 319px;
  flex-shrink: 0;
  background: var(--brown-dark);
  color: #fff;
  padding: 25px 25px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sidebar-brand {
  text-align: center;
  padding-bottom: 28px;
  border-bottom: 1px solid rgba(255, 255, 255, .12);
}
.sidebar-brand .logo { font-size: 3.2rem; line-height: 1; }
.sidebar-brand h2 { font-size: 1.9rem; margin: 10px 0 6px; }
.sidebar-brand p { font-size: .9rem; color: #f0dfcc; }

.menu-label {
  font-size: .8rem;
  letter-spacing: 2px;
  font-weight: 700;
  margin: 34px 0 14px 13px;
}
.menu-item {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 16px 13px;
  color: #fff;
  text-decoration: none;
  font-size: 1.05rem;
  border-radius: 12px;
  transition: background .2s;
}
.menu-item:hover, .menu-item.active { background: rgba(255, 255, 255, .12); }
.menu-item .ico { font-size: 1.4rem; width: 28px; text-align: center; }

.main { flex: 1; padding: 22px 44px 50px; min-width: 0; }

/* ===== Topbar ===== */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 36px;
}
.topbar h1 { font-size: 2.1rem; color: var(--brown-dark); margin-bottom: 4px; }
.user-chip {
  background: var(--white);
  padding: 14px 26px;
  border-radius: 40px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--brown-dark);
  white-space: nowrap;
}
.user-chip a {
  margin-left: 10px;
  font-size: .85rem;
  color: var(--brown);
  text-decoration: none;
  font-weight: 600;
}
.user-chip a:hover { text-decoration: underline; }

/* ===== Hero ===== */
.hero {
  background: linear-gradient(135deg, var(--brown-hero-1), var(--brown-hero-2));
  color: #fff;
  border-radius: 22px;
  padding: 50px 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 40px;
}
.hero h2 { font-size: 2rem; margin-bottom: 18px; }
.hero p { font-size: 1.05rem; }
.hero-icon { font-size: 4.5rem; padding-right: 50px; }

/* ===== Sections ===== */
.section-title { font-size: 1.7rem; color: var(--brown-dark); margin-bottom: 8px; }
section { margin-bottom: 32px; }

/* ===== Stats ===== */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-top: 20px;
}
.stat-card {
  background: var(--white);
  border: 1px solid #f1e6da;
  border-radius: 16px;
  padding: 26px;
  box-shadow: var(--shadow);
}
.stat-card h4 { font-size: 1rem; color: var(--brown-dark); margin-bottom: 14px; }
.stat-card .num { font-size: 2.4rem; font-weight: 700; color: var(--brown-dark); }
.stat-card small { display: block; margin-top: 8px; color: var(--muted); }

/* ===== Module cards ===== */
.modules {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-top: 20px;
}
.module-card {
  background: var(--white);
  border: 1px solid #f1e6da;
  border-radius: var(--radius);
  padding: 31px;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
  transition: transform .2s, box-shadow .2s;
}
.module-card:hover { transform: translateY(-3px); box-shadow: 0 8px 20px rgba(90, 58, 30, .12); }
.module-icon {
  width: 66px; height: 66px;
  background: #faf0e4;
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem;
  margin-bottom: 22px;
}
.module-card h3 { font-size: 1.25rem; color: var(--brown-dark); margin-bottom: 14px; }
.module-card p { color: var(--muted); line-height: 1.6; flex: 1; margin-bottom: 22px; }
.btn-module {
  display: block;
  text-align: center;
  background: var(--tan);
  color: var(--brown-dark);
  font-weight: 600;
  padding: 14px;
  border-radius: 10px;
  text-decoration: none;
  transition: background .2s;
}
.btn-module:hover { background: #e8d3b9; }
.btn-module.inline { display: inline-block; padding: 14px 24px; margin-top: 18px; }

.placeholder {
  background: var(--white);
  padding: 40px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ===== Responsive ===== */
@media (max-width: 1200px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .modules { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 800px) {
  .app-page { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; }
  .main { padding: 20px; }
  .topbar { flex-direction: column; }
  .hero { padding: 30px 24px; }
  .hero-icon { display: none; }
  .stats, .modules { grid-template-columns: 1fr; }
}

/* ===== User Management page ===== */
.plain-page { background: #f7efe5; min-height: 100vh; }
.page-header {
  background: #704c34;
  color: #fff;
  padding: 25px;
  padding-bottom: 45px;
}
.page-header h1 { font-size: 2.3rem; margin-bottom: 26px; }
.page-header p { font-size: 1.3rem; }

.page-container { max-width: 1227px; margin: 0 auto; padding: 72px 20px 60px; }
.back-link {
  display: inline-block;
  color: #6b3f1d;
  font-weight: 700;
  font-size: 1.2rem;
  text-decoration: none;
  margin-bottom: 20px;
}
.back-link:hover { text-decoration: underline; }

.panel {
  background: #fff;
  border-radius: 22px;
  padding: 28px;
  margin-bottom: 28px;
  box-shadow: var(--shadow);
}
.panel h2 { font-size: 2rem; color: var(--brown-dark); margin: 24px 0 24px; }
.panel label {
  display: block;
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--brown-dark);
  margin-bottom: 8px;
}
.panel input, .panel select {
  width: 100%;
  padding: 14px 14px;
  font-size: 1rem;
  border: 1px solid #d9cbbd;
  border-radius: 6px;
  margin-bottom: 18px;
  background: #fff;
}
.panel input:focus, .panel select:focus { outline: 2px solid var(--brown); }
.btn-primary {
  background: #6b3f1d;
  color: #fff;
  border: 0;
  padding: 16px 25px;
  font-size: 1.05rem;
  border-radius: 8px;
  cursor: pointer;
}
.btn-primary:hover { background: #55320f; }

.form-message { padding: 12px 16px; border-radius: 8px; margin-bottom: 20px; }
.form-message.ok  { background: #e6f4ea; color: #1e6b36; }
.form-message.err { background: #fde8e8; color: #a12020; }

.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { text-align: left; padding: 14px 12px; border-bottom: 1px solid #f1e6da; }
.data-table th { color: var(--brown-dark); font-size: .95rem; }
.data-table .empty { text-align: center; color: var(--muted); padding: 28px; }

.role-badge { padding: 4px 12px; border-radius: 20px; font-size: .85rem; font-weight: 600; background: var(--tan); color: var(--brown-dark); }
.role-badge.owner { background: #e9d3f5; color: #4b2a63; }
.role-badge.baker { background: #fde7c4; color: #7a4a0b; }
.role-badge.customer { background: #d6ecf7; color: #1d5876; }

.btn-danger { background: #fde8e8; color: #a12020; border: 0; padding: 8px 14px; border-radius: 8px; cursor: pointer; font-weight: 600; }
.btn-danger:hover { background: #f8cfcf; }
