/* Ivy Route App Styles */

:root {
  --ivy-green: #2D6A4F;
  --ivy-green-dark: #1B4332;
  --ivy-gold: #D4A843;
  --sidebar-width: 220px;
  --topbar-height: 48px;
  --menubar-height: 42px;
  --tabbar-height: 38px;
  --pico-border-radius: 0;
}

/* ─── Reset / Base ─── */
html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: #f5f5f5;
}

/* Square corners on inputs, buttons, selects */
button, input, select, textarea,
[role="button"], article, details {
  border-radius: 0 !important;
}

/* ─── Compact Tables ─── */
table {
  font-size: 0.9rem;
  width: 100%;
  border-collapse: collapse;
}
table th,
table td {
  padding: 0.4rem 0.6rem;
  text-align: left;
}
table thead th {
  background: #f5f5f5;
  border-bottom: 2px solid #e0e8e0;
  font-weight: 600;
}
table tbody tr {
  border-bottom: 1px solid #f0f0f0;
}
table tbody tr:nth-child(even) {
  background: #fafafa;
}
table tbody tr:hover {
  background: #f0f7f4;
}
table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
table .text {
  text-align: left;
}

/* ─── Labels & Fields ─── */
label {
  font-weight: 600;
  font-size: 0.85rem;
  margin-bottom: 0.2rem;
}
input:not([type="checkbox"]):not([type="radio"]),
select, textarea {
  font-size: 0.85rem;
  --pico-form-element-spacing-vertical: 0.25rem;
  --pico-form-element-spacing-horizontal: 0.45rem;
}
.form-group {
  margin-bottom: 0.65rem;
}
.form-group label {
  display: block;
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}
.form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.75rem;
}

/* ─── Panels / Cards ─── */
.panel {
  border: 1px solid #e0e8e0;
  overflow: hidden;
}
.panel-header {
  background: #f8faf8;
  padding: 0.5rem 0.75rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ivy-green-dark);
  border-bottom: 1px solid #e0e8e0;
}
.panel-body {
  padding: 0.75rem;
  font-size: 0.9rem;
}

/* ─── Top Bar ─── */
.topbar {
  height: var(--topbar-height);
  background: var(--ivy-green-dark);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  font-size: 14px;
}
.topbar-brand {
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.5px;
}
.topbar-user {
  display: flex;
  align-items: center;
  gap: 12px;
}
.topbar-user .avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--ivy-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--ivy-green-dark);
}

/* ─── Menu Bar ─── */
.menubar {
  height: var(--menubar-height);
  background: var(--ivy-green);
  display: flex;
  align-items: center;
  padding: 0 8px;
  gap: 0;
  user-select: none;
}
.menubar-item {
  position: relative;
  padding: 0 20px;
  height: 100%;
  display: flex;
  align-items: center;
  color: rgba(255,255,255,0.85);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  border: none;
  background: none;
  border-radius: 0;
  transition: background 0.15s;
}
.menubar-item:hover {
  background: rgba(255,255,255,0.12);
  color: #fff;
}
.menubar-item.active {
  background: rgba(255,255,255,0.18);
  color: #fff;
  font-weight: 600;
}
.menubar-item.disabled {
  color: rgba(255,255,255,0.4);
  cursor: default;
}
.menubar-item.disabled:hover {
  background: none;
}
.menubar-spacer {
  flex: 1;
}
.menubar-item.gear {
  font-size: 20px;
  padding: 0 16px;
}

/* ─── Dropdown Menu ─── */
.menubar-item .dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  min-width: 200px;
  z-index: 1000;
  padding: 4px 0;
}
.menubar-item:hover .dropdown {
  display: block;
}
.menubar-item .dropdown-item {
  display: block;
  padding: 8px 16px;
  font-size: 13px;
  color: #333;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}
.menubar-item .dropdown-item:hover {
  background: #f0f7f4;
  color: var(--ivy-green-dark);
}
.menubar-item .dropdown-item.disabled {
  color: #bbb;
  pointer-events: none;
}
.menubar-item .dropdown-divider {
  height: 1px;
  background: #eee;
  margin: 4px 0;
}
.menubar-item .dropdown-sub {
  position: relative;
}
.menubar-item .dropdown-sub .dropdown {
  left: 100%;
  top: -4px;
  display: none;
}
.menubar-item .dropdown-sub:hover > .dropdown {
  display: block;
}

/* ─── Tab Bar ─── */
.tabbar {
  height: var(--tabbar-height);
  background: #e8e8e8;
  display: flex;
  align-items: center;
  padding: 0 8px;
  gap: 2px;
  border-bottom: 1px solid #ccc;
}
.tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  font-size: 12px;
  background: #d0d0d0;
  border: 1px solid #ccc;
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  cursor: pointer;
  white-space: nowrap;
  color: #555;
  margin-bottom: -1px;
}
.tab:hover {
  background: #c8c8c8;
}
.tab.active {
  background: #fff;
  color: var(--ivy-green-dark);
  font-weight: 600;
  border-bottom-color: #fff;
}
.tab .close {
  font-size: 14px;
  line-height: 1;
  color: #999;
  cursor: pointer;
  padding: 0 2px;
}
.tab .close:hover {
  color: #c00;
}
.tab-new {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 4px;
  font-size: 16px;
  color: #888;
  cursor: pointer;
  margin-left: 4px;
}
.tab-new:hover {
  background: #d0d0d0;
  color: #333;
}

/* ─── Content Area ─── */
.content {
  height: calc(100vh - var(--topbar-height) - var(--menubar-height) - var(--tabbar-height));
  overflow-y: auto;
  background: #fff;
}
.content > div {
  display: none;
  padding: 24px;
  height: 100%;
}
.content > div.active {
  display: block;
}
.tab-panel {
  display: none;
  height: 100%;
  padding: 0;
}
.tab-panel.active {
  display: block;
}

/* ─── Dashboard Stats ─── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: #f8faf8;
  border: 1px solid #e0e8e0;
  border-radius: 8px;
  padding: 20px;
}
.stat-card .label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #888;
  margin-bottom: 4px;
}
.stat-card .value {
  font-size: 28px;
  font-weight: 700;
  color: var(--ivy-green-dark);
}
.stat-card .sub {
  font-size: 12px;
  color: #999;
  margin-top: 4px;
}

/* ─── Dashboard Panels ─── */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.panel {
  border: 1px solid #e0e8e0;
  border-radius: 8px;
  overflow: hidden;
}
.panel-header {
  background: #f8faf8;
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ivy-green-dark);
  border-bottom: 1px solid #e0e8e0;
}
.panel-body {
  padding: 12px 16px;
  font-size: 13px;
}
.activity-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid #f0f0f0;
  color: #555;
}
.activity-item:last-child {
  border-bottom: none;
}
.activity-item .time {
  color: #bbb;
  font-size: 11px;
  min-width: 60px;
}

/* ─── Calendar (start screen style) ─── */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  font-size: 12px;
  text-align: center;
}
.calendar-grid .day-header {
  font-weight: 600;
  color: #888;
  padding: 4px 0;
}
.calendar-grid .day {
  padding: 6px 0;
  border-radius: 4px;
  color: #555;
}
.calendar-grid .day.today {
  background: var(--ivy-green);
  color: #fff;
  font-weight: 600;
}
.calendar-grid .day.other-month {
  color: #ddd;
}

/* ─── 28-Day Cycle Calendar ─── */
.cycle-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  font-size: 0.8rem;
  text-align: center;
}
.cycle-grid .day-header {
  font-weight: 600;
  color: #666;
  padding: 3px 0;
  font-size: 0.75rem;
}
.cycle-grid .day {
  padding: 4px 0;
  color: #555;
}
.cycle-grid .day.today {
  color: #000;
  font-weight: 700;
  font-size: 0.95rem;
}
.cycle-grid .day.week-1 { background: #f0f7f4; }
.cycle-grid .day.week-2 { background: #e8f5e9; }
.cycle-grid .day.week-3 { background: #d4edda; }
.cycle-grid .day.week-4 { background: #c8e6c9; }
.cycle-label {
  font-size: 0.7rem;
  color: #999;
  text-align: center;
  margin-top: 2px;
}
.cycle-label.current {
  color: var(--ivy-green);
  font-weight: 600;
}

/* ─── Status Bar ─── */
.statusbar {
  height: 28px;
  background: var(--ivy-green-dark);
  color: rgba(255,255,255,0.7);
  display: flex;
  align-items: center;
  padding: 0 16px;
  font-size: 11px;
  gap: 16px;
}
