/* BakeOS — Cottage pink bakery theme */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;600;700&family=DM+Sans:wght@400;500;600;700&display=swap');

:root {
  --bg: #FFF5F7;
  --card: #FFFFFF;
  --nav-bg: #BE185D;
  --nav-fg: #FFF1F2;
  --nav-hover: #F9A8D4;
  --text: #4A1942;
  --muted: #9D7A9F;
  --border: #F3D5E0;
  --accent: #DB2777;
  --accent-light: #FBCFE8;
  --primary: #A855F7;
  --success: #059669;
  --warning: #D97706;
  --danger: #E11D48;
  --sage: #6B8F71;
  --lavender: #C4B5FD;
  --cream: #FDF6EC;
  --rose-mist: #FCE7F3;
  --radius: 14px;
}

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

body {
  font-family: "DM Sans", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  background: var(--bg);
  background-image:
    radial-gradient(ellipse at 20% 50%, rgba(251, 207, 232, 0.3) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(196, 181, 253, 0.2) 0%, transparent 50%);
  color: var(--text);
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  -webkit-touch-callout: none;
  touch-action: manipulation;
}

/* Nav */
nav {
  background: var(--nav-bg);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(190, 24, 93, 0.15);
}
nav .logo {
  font-family: "Playfair Display", Georgia, serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--nav-fg);
  text-decoration: none;
  margin-right: 16px;
  letter-spacing: 0.5px;
}
nav a {
  color: rgba(255, 241, 242, 0.7);
  text-decoration: none;
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 500;
  min-height: 44px;
  display: flex;
  align-items: center;
  transition: all 0.15s;
}
nav a:hover, nav a.active {
  background: rgba(255,255,255,0.18);
  color: var(--nav-fg);
}

/* Container */
.container {
  max-width: 1024px;
  margin: 0 auto;
  padding: 20px;
}

/* Cards */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  border: 1px solid var(--border);
  margin-bottom: 16px;
  box-shadow: 0 1px 6px rgba(190, 24, 93, 0.06);
}
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

/* KPI Cards */
.kpi-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px 20px;
  border: 1px solid var(--border);
  box-shadow: 0 1px 6px rgba(190, 24, 93, 0.06);
}
.kpi-card .label {
  font-family: "DM Sans", sans-serif;
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}
.kpi-card .value {
  font-family: "Playfair Display", Georgia, serif;
  font-size: 28px;
  font-weight: 700;
  margin-top: 4px;
}
.kpi-card .value.emerald { color: var(--success); }
.kpi-card .value.blue { color: var(--primary); }
.kpi-card .value.amber { color: var(--accent); }
.kpi-card .value.teal { color: var(--sage); }

/* Section headers */
h1 {
  font-family: "Playfair Display", Georgia, serif;
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text);
}
h2 {
  font-family: "Playfair Display", Georgia, serif;
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text);
}
h3 {
  font-family: "Playfair Display", Georgia, serif;
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 8px;
}

/* Motivation banner */
.motivation {
  background: linear-gradient(135deg, #EC4899 0%, #DB2777 50%, #A855F7 100%);
  color: white;
  border-radius: var(--radius);
  padding: 18px 24px;
  font-family: "Playfair Display", Georgia, serif;
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 20px;
  font-style: italic;
  box-shadow: 0 4px 16px rgba(219, 39, 119, 0.2);
}

/* Status badges */
.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.badge-pending { background: #FCE7F3; color: #BE185D; }
.badge-confirmed { background: #EDE9FE; color: #7C3AED; }
.badge-ready { background: #D1FAE5; color: #065F46; }
.badge-completed { background: #F3F4F6; color: #6B7280; }
.badge-cancelled { background: #FEE2E2; color: #991B1B; }

/* Filter tabs */
.filter-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.filter-tabs a, .filter-tabs button {
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
  min-height: 44px;
  display: flex;
  align-items: center;
  cursor: pointer;
}
.filter-tabs a.active, .filter-tabs button.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(219, 39, 119, 0.25);
}

/* Order cards */
.order-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px 20px;
  border: 1px solid var(--border);
  margin-bottom: 12px;
  text-decoration: none;
  color: var(--text);
  display: block;
  transition: box-shadow 0.15s;
}
.order-card {
  box-shadow: 0 1px 4px rgba(190, 24, 93, 0.06);
}
.order-card:active {
  box-shadow: 0 0 0 2px var(--accent);
  background: var(--rose-mist);
}
.order-card .order-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.order-card .order-client {
  font-weight: 600;
  font-size: 16px;
}
.order-card .order-desc {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 8px;
}
.order-card .order-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
}
.order-card .order-amount {
  font-weight: 700;
  font-size: 18px;
}
.order-card .order-pickup {
  color: var(--muted);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  min-height: 48px;
  text-decoration: none;
  transition: opacity 0.15s;
}
.btn:active { opacity: 0.8; }
.btn-primary { background: var(--primary); color: white; box-shadow: 0 2px 8px rgba(168, 85, 247, 0.25); }
.btn-success { background: var(--success); color: white; box-shadow: 0 2px 8px rgba(5, 150, 105, 0.25); }
.btn-warning { background: var(--warning); color: white; }
.btn-danger { background: var(--danger); color: white; box-shadow: 0 2px 8px rgba(225, 29, 72, 0.2); }
.btn-accent { background: var(--accent); color: white; box-shadow: 0 2px 8px rgba(219, 39, 119, 0.25); }
.btn-outline {
  background: transparent;
  border: 2px solid var(--border);
  color: var(--text);
}
.btn-rose { background: #F9A8D4; color: #831843; }
.btn-sm { padding: 8px 16px; font-size: 14px; min-height: 40px; }
.btn-block { width: 100%; }
.btn + .btn { margin-left: 8px; }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 6px;
}
input[type="text"], input[type="number"], input[type="date"],
input[type="email"], input[type="tel"], input[type="search"],
select, textarea {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 16px; /* prevents Safari zoom */
  font-family: inherit;
  background: var(--card);
  color: var(--text);
  min-height: 48px;
  -webkit-appearance: none;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(219, 39, 119, 0.12);
}
textarea { min-height: 80px; resize: vertical; }

/* Tables (for accounting) */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.data-table th {
  text-align: left;
  padding: 10px 12px;
  font-weight: 600;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid var(--border);
}
.data-table td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table tr:hover { background: var(--rose-mist); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted { color: var(--muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-accent { color: var(--accent); }
.font-mono { font-family: "SF Mono", monospace; }

/* Flash messages */
.flash {
  padding: 12px 20px;
  border-radius: 10px;
  margin-bottom: 16px;
  font-weight: 500;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.flash-success { background: #D1FAE5; color: #065F46; border: 1px solid #A7F3D0; }
.flash-error { background: #FCE7F3; color: #9D174D; border: 1px solid #FBCFE8; }
.flash-info { background: #EDE9FE; color: #5B21B6; border: 1px solid #DDD6FE; }
.flash .dismiss { cursor: pointer; padding: 4px 8px; opacity: 0.6; }

/* Activity feed */
.feed-item {
  display: flex;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  gap: 12px;
  font-size: 14px;
}
.feed-item:last-child { border-bottom: none; }
.feed-time { color: var(--muted); min-width: 80px; font-size: 13px; }
.feed-type {
  font-weight: 600;
  min-width: 50px;
  font-size: 12px;
  text-transform: uppercase;
}
.feed-desc { flex: 1; }
.feed-amount { font-weight: 700; color: var(--success); }

/* Revenue bar chart (CSS-only) */
.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 120px;
  padding: 8px 0;
}
.bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.bar {
  width: 100%;
  background: linear-gradient(to top, var(--accent), #F472B6);
  border-radius: 6px 6px 0 0;
  min-height: 4px;
  transition: height 0.3s;
}
.bar-label { font-size: 11px; color: var(--muted); }
.bar-value { font-size: 11px; font-weight: 600; color: var(--text); }

/* Detail page */
.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
}
.detail-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.detail-label { color: var(--muted); font-weight: 500; }
.detail-value { font-weight: 600; text-align: right; }
.amount-big { font-size: 32px; font-weight: 700; }

/* Actions section */
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
}
.action-form { display: inline; }

/* Accounting overview grid */
.acct-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}
.acct-link {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  font-size: 15px;
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: box-shadow 0.15s;
}
.acct-link {
  transition: all 0.15s;
  box-shadow: 0 1px 4px rgba(190, 24, 93, 0.06);
}
.acct-link:active { box-shadow: 0 0 0 2px var(--accent); background: var(--rose-mist); }

/* P&L */
.pnl-section { margin-bottom: 24px; }
.pnl-total {
  font-weight: 700;
  font-size: 18px;
  padding-top: 8px;
  border-top: 2px solid var(--text);
}
.pnl-net {
  font-size: 24px;
  font-weight: 700;
  padding: 16px 0;
}
.pnl-net.positive { color: var(--success); }
.pnl-net.negative { color: var(--danger); }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--muted);
}
.empty-state .emoji { font-size: 48px; margin-bottom: 12px; }
.empty-state p { font-size: 16px; margin-bottom: 16px; }

/* Spacing helpers */
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.mt-4 { margin-top: 16px; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-2 { gap: 8px; }

/* Print */
@media print {
  nav, .btn, .filter-tabs, .flash, .actions { display: none; }
  body { background: white; }
  .container { max-width: none; padding: 0; }
}

/* Top items */
.top-item {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.top-item:last-child { border-bottom: none; }

/* Cottage vintage accents */
.divider {
  border: none;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--accent-light), var(--lavender), var(--accent-light), transparent);
  margin: 24px 0;
}

/* Corner accent removed — was overlapping card content */
.card { position: relative; overflow: hidden; }

/* P&L positive/negative with vintage feel */
.pnl-net {
  font-family: "Playfair Display", Georgia, serif;
}

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

/* Selection color */
::selection { background: var(--accent-light); color: var(--text); }

/* ============================================================
   Mobile / Tablet responsive
   ============================================================ */

/* Tablet (iPad) */
@media (max-width: 820px) {
  nav {
    flex-wrap: wrap;
    gap: 4px;
    padding: 10px 12px;
  }
  nav a {
    font-size: 13px;
    padding: 6px 10px;
    min-height: 36px;
  }
  .container { padding: 16px 12px; }
  .card-grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }

  /* Stack two-column grids */
  div[style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
}

/* Phone (iPhone) */
@media (max-width: 480px) {
  nav {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    gap: 2px;
    padding: 8px;
  }
  nav a {
    font-size: 12px;
    padding: 6px 8px;
    white-space: nowrap;
    min-height: 32px;
  }
  nav .logo {
    font-size: 16px;
    margin-right: 4px;
  }
  .container { padding: 12px 8px; }

  h1 { font-size: 22px; }
  h3 { font-size: 16px; }

  .card { padding: 14px 12px; }
  .card-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  .kpi-card { padding: 12px; }
  .kpi-card .label { font-size: 10px; }
  .kpi-card .value { font-size: 20px; }

  /* Stack flex-between on small screens */
  .flex-between {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  /* Tables scroll horizontally */
  .data-table { font-size: 13px; }
  table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  thead, tbody, tr { min-width: 100%; }

  /* Filter tabs scroll */
  .filter-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
  }
  .filter-tabs a {
    white-space: nowrap;
    font-size: 13px;
    padding: 6px 10px;
  }

  /* Forms stack */
  form[style*="display:flex"] {
    flex-direction: column !important;
  }
  form[style*="display:grid"] {
    grid-template-columns: 1fr !important;
  }

  /* Buttons full width on phone */
  .btn-block, .btn-accent, .btn-success, .btn-primary {
    width: 100%;
    text-align: center;
  }

  /* Detail rows */
  .detail-row {
    flex-direction: column;
    gap: 2px;
  }
  .detail-row .detail-value {
    font-size: 16px;
  }

  /* Feed items */
  .feed-item {
    flex-wrap: wrap;
    gap: 4px;
  }
  .feed-time { min-width: auto; font-size: 12px; }

  /* Order detail amounts */
  .font-mono { font-size: 14px; }
}
