/* ── Reset & base ─────────────────────────────────────────────────────────── */
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; font-size: 14px; background: #f4f6f4; color: #2c3e2c; }

/* ── App layout ───────────────────────────────────────────────────────────── */
.app-layout { display: flex; height: 100vh; overflow: hidden; }

/* ── Sidebar ──────────────────────────────────────────────────────────────── */
.sidebar { width: 200px; min-width: 200px; background: #1a2e1a; height: 100vh; overflow-y: auto; padding: 0; display: flex; flex-direction: column; }
.sidebar-logo { padding: 20px 16px 14px; border-bottom: 1px solid #2d4a2d; display: block; text-decoration: none; cursor: pointer; }
.sidebar-logo .logo-icon { font-size: 28px; display: block; text-align: center; margin-bottom: 4px; }
.sidebar-logo h2 { color: #c8e6c8; font-size: 12px; text-align: center; line-height: 1.4; font-weight: 600; letter-spacing: .5px; text-transform: uppercase; }
.sidebar nav { padding: 12px 0; flex: 1; }
.sidebar nav a { display: block; padding: 9px 18px; color: #8fbc8f; text-decoration: none; font-size: 13px; border-left: 3px solid transparent; transition: all .15s; }
.nav-group a { padding-left: 32px; }
.sidebar nav a:hover { background: #2d4a2d; color: #c8e6c8; }
.sidebar nav a.active { background: #2d4a2d; color: #fff; border-left-color: #5da85d; font-weight: 600; }
.sidebar nav .nav-section { padding: 12px 18px 4px; font-size: 10px; color: #4a6b4a; text-transform: uppercase; letter-spacing: 1px; font-weight: 700; }
.nav-section-toggle { display: flex; justify-content: space-between; align-items: center; width: 100%; padding: 12px 18px 4px; background: none; border: none; cursor: pointer; font-size: 10px; color: #4a6b4a; text-transform: uppercase; letter-spacing: 1px; font-weight: 700; text-align: left; }
.nav-section-toggle:hover { color: #8fbc8f; }
.nav-section-toggle .toggle-icon { font-size: 14px; font-weight: 400; line-height: 1; margin-left: 4px; }
.sidebar-user { padding: 14px 16px; border-top: 1px solid #2d4a2d; }
.sidebar-user .name { color: #c8e6c8; font-size: 12px; font-weight: 600; }
.sidebar-user .role { color: #5da85d; font-size: 11px; margin-top: 2px; }
.sidebar-user .logout { display: block; margin-top: 8px; color: #8fbc8f; font-size: 12px; text-decoration: none; }
.sidebar-user .logout:hover { color: #fff; }

/* ── Main content ─────────────────────────────────────────────────────────── */
.main { flex: 1; padding: 24px; overflow-y: auto; overflow-x: auto; height: 100vh; }
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.page-header h1 { font-size: 20px; color: #1a2e1a; font-weight: 700; }
.page-header .subtitle { font-size: 13px; color: #6b8f6b; margin-top: 2px; }

/* ── Alerts ───────────────────────────────────────────────────────────────── */
.alert { padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; font-size: 13px; }
.alert-error   { background: #fde8e8; color: #7b241c; border: 1px solid #f5c6cb; }
.alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.auth-flash { position: fixed; top: 0; left: 0; right: 0; padding: 10px 20px; font-size: 13px; text-align: center; z-index: 999; }
.auth-flash-error { background: #fde8e8; color: #7b241c; }

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: 5px; padding: 7px 14px; border: none; border-radius: 5px; cursor: pointer; font-size: 13px; font-weight: 600; text-decoration: none; transition: all .15s; }
.btn-primary   { background: #2d7a2d; color: #fff; }
.btn-primary:hover { background: #1f5f1f; }
.btn-secondary { background: #e8f0e8; color: #2c3e2c; border: 1px solid #b8d4b8; }
.btn-secondary:hover { background: #d4e8d4; }
.btn-danger    { background: #c0392b; color: #fff; }
.btn-danger:hover { background: #a93226; }
.btn-warn      { background: #e67e22; color: #fff; }
.btn-sm        { padding: 4px 10px; font-size: 12px; }

/* ── Cards ────────────────────────────────────────────────────────────────── */
.card { background: #fff; border-radius: 8px; box-shadow: 0 1px 4px rgba(0,0,0,.08); margin-bottom: 16px; }
.card-header { padding: 14px 18px; border-bottom: 1px solid #e8f0e8; display: flex; align-items: center; justify-content: space-between; }
.card-header h3 { font-size: 14px; font-weight: 700; color: #1a2e1a; }
.card-body { padding: 16px 18px; }

/* ── Tables ───────────────────────────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; }
th { background: #f0f6f0; padding: 9px 12px; text-align: left; font-size: 12px; font-weight: 700; color: #4a6b4a; text-transform: uppercase; letter-spacing: .4px; border-bottom: 2px solid #d4e8d4; }
td { padding: 9px 12px; border-bottom: 1px solid #f0f6f0; font-size: 13px; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #f8fbf8; }

/* ── Badges ───────────────────────────────────────────────────────────────── */
.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 700; letter-spacing: .2px; }
.badge-open     { background: #d4edda; color: #155724; }
.badge-closed   { background: #d6eaf8; color: #1a5276; }
.badge-canceled { background: #fde8e8; color: #7b241c; }
.badge-draft    { background: #fef9e7; color: #7d6608; border: 1px solid #f9e79f; }
.badge-golfer   { background: #e8f5e9; color: #2e7d32; }
.badge-coord    { background: #e3f2fd; color: #1565c0; }
.badge-dbadmin  { background: #f3e5f5; color: #6a1b9a; }
.badge-waitlist { background: #f0f0f0; color: #888; }
.badge-confirmed{ background: #d4edda; color: #155724; }
.badge-declined { background: #fde8e8; color: #7b241c; }
.badge-inactive { background: #f5f5f5; color: #999; border: 1px solid #ddd; }

/* ── Forms ────────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 14px; }
.form-error { background: #fde8e8; color: #7b241c; border: 1px solid #f5c6cb; border-radius: 5px; padding: 8px 12px; margin-bottom: 14px; font-size: 13px; }
label { display: block; font-size: 12px; font-weight: 700; color: #4a6b4a; margin-bottom: 4px; text-transform: uppercase; letter-spacing: .3px; }
input[type=text], input[type=email], input[type=tel], input[type=password], input[type=date], input[type=time], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid #b8d4b8; border-radius: 5px; font-size: 13px; color: #2c3e2c; background: #fff; transition: border .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: #5da85d; box-shadow: 0 0 0 2px rgba(93,168,93,.15); }
.form-row   { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.checkbox-row { display: flex; align-items: center; gap: 8px; }
.checkbox-row input[type=checkbox] { width: auto; }
.checkbox-row label { margin: 0; text-transform: none; font-size: 13px; font-weight: 400; color: #2c3e2c; }

/* ── Login page ───────────────────────────────────────────────────────────── */
.login-page { min-height: 100vh; background: linear-gradient(160deg, #0f1e0f 0%, #1a3a1a 50%, #0f2a0f 100%); display: flex; align-items: center; justify-content: center; }
.login-box { background: #fff; border-radius: 12px; padding: 40px 36px; width: 360px; box-shadow: 0 8px 32px rgba(0,0,0,.3); }
.login-box .logo { text-align: center; margin-bottom: 24px; }
.login-box .logo .icon { font-size: 48px; display: block; }
.login-box .logo h1 { font-size: 18px; color: #1a2e1a; font-weight: 700; margin-top: 8px; line-height: 1.3; }
.login-box .logo p { font-size: 12px; color: #6b8f6b; margin-top: 4px; }
.login-box .btn-primary { width: 100%; justify-content: center; padding: 10px; font-size: 14px; margin-top: 4px; }

/* ── Stat cards ───────────────────────────────────────────────────────────── */
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.stat-card { background: #fff; border-radius: 8px; padding: 16px 18px; box-shadow: 0 1px 4px rgba(0,0,0,.08); border-left: 4px solid #5da85d; }
.stat-card .value { font-size: 28px; font-weight: 700; color: #1a2e1a; }
.stat-card .label { font-size: 12px; color: #6b8f6b; margin-top: 2px; text-transform: uppercase; letter-spacing: .4px; }
.stat-card.blue   { border-left-color: #3498db; }
.stat-card.orange { border-left-color: #e67e22; }
.stat-card.gray   { border-left-color: #95a5a6; }

/* ── Outing cards ─────────────────────────────────────────────────────────── */
.outing-card { background: #fff; border-radius: 8px; box-shadow: 0 1px 4px rgba(0,0,0,.08); margin-bottom: 12px; border-left: 5px solid #5da85d; overflow: hidden; }
.outing-card.closed   { border-left-color: #3498db; }
.outing-card.canceled { border-left-color: #e74c3c; opacity: .75; }
.outing-card.draft    { border-left-color: #f0c040; }
.outing-card-header { padding: 14px 18px; display: flex; align-items: flex-start; justify-content: space-between; }
.outing-card-header .date { font-size: 16px; font-weight: 700; color: #1a2e1a; }
.outing-card-header .course { font-size: 13px; color: #6b8f6b; margin-top: 3px; }
.outing-card-header .coordinator { font-size: 12px; color: #8fa88f; margin-top: 2px; }
.outing-card-footer { padding: 10px 18px; background: #f8fbf8; border-top: 1px solid #f0f6f0; display: flex; align-items: center; justify-content: space-between; }
.outing-card-footer .signups { font-size: 12px; color: #6b8f6b; }
.outing-card-footer .signups strong { color: #2d7a2d; }

/* ── Weather block ────────────────────────────────────────────────────────── */
.weather-block { background: linear-gradient(135deg, #e8f4fd 0%, #d6eaf8 100%); border: 1px solid #aed6f1; border-radius: 8px; padding: 14px 18px; margin-bottom: 16px; display: flex; gap: 24px; align-items: center; flex-wrap: wrap; }
.weather-block .weather-icon { font-size: 36px; }
.weather-block .weather-main { flex: 1; }
.weather-block .weather-temp { font-size: 22px; font-weight: 700; color: #1a5276; }
.weather-block .weather-desc { color: #2874a6; font-size: 13px; margin-top: 2px; }
.weather-block .weather-details { display: flex; gap: 16px; margin-top: 8px; flex-wrap: wrap; }
.weather-block .weather-detail { font-size: 12px; color: #5d6d7e; }
.weather-block .weather-detail span { font-weight: 600; color: #1a5276; }

/* ── Signup list ──────────────────────────────────────────────────────────── */
.signup-row td { font-size: 13px; }
.signup-row.waitlist td { color: #aaa; font-style: italic; }
.waitlist-divider td { background: #f8f8f8; color: #aaa; font-size: 11px; font-style: italic; padding: 4px 12px; text-align: center; letter-spacing: 1px; }

/* ── Roster builder ───────────────────────────────────────────────────────── */
.roster-layout { display: grid; grid-template-columns: 260px 1fr; gap: 16px; }
.unassigned-list { display: flex; flex-direction: column; gap: 6px; }
.golfer-chip { background: #e8f5e9; border: 1px solid #c8e6c9; border-radius: 6px; padding: 8px 12px; cursor: grab; display: flex; justify-content: space-between; align-items: center; }
.golfer-chip:hover { background: #c8e6c9; }
.golfer-chip .pref { font-size: 11px; color: #5a8a5a; margin-top: 2px; font-style: italic; }
.tee-time-card { background: #fff; border: 2px solid #d4e8d4; border-radius: 8px; margin-bottom: 12px; }
.tee-time-card.full { border-color: #b8ccc8; background: #f8fbfa; }
.tee-time-header { padding: 10px 14px; background: #e8f5e9; border-radius: 6px 6px 0 0; display: flex; align-items: center; justify-content: space-between; }
.tee-time-header.full { background: #e8eceb; }
.tee-time-header .time { font-weight: 700; font-size: 15px; color: #1a2e1a; }
.tee-time-header .mode { font-size: 11px; color: #5a8a5a; margin-left: 8px; }
.tee-time-slots { padding: 10px 14px; display: flex; flex-direction: column; gap: 6px; }
.slot { border: 1px dashed #b8d4b8; border-radius: 5px; padding: 7px 10px; min-height: 36px; font-size: 13px; display: flex; align-items: center; justify-content: space-between; color: #888; }
.slot.filled { border: 1px solid #c8e6c9; background: #f0faf0; color: #2c3e2c; font-weight: 500; }
.slot.filled .slot-remove { color: #e74c3c; cursor: pointer; font-size: 16px; font-weight: 700; line-height: 1; }

/* ── Tooltips ─────────────────────────────────────────────────────────────── */
[data-tip] { cursor: default; }
#app-tooltip {
  position: fixed;
  background: #1a2e1a;
  color: #fff;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.4;
  padding: 5px 9px;
  border-radius: 5px;
  white-space: normal;
  width: max-content;
  max-width: 260px;
  z-index: 99999;
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s;
  text-transform: none;
  letter-spacing: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
#app-tooltip.visible { opacity: 1; }
#app-tooltip::after {
  content: '';
  position: absolute;
  left: var(--caret, 50%);
  transform: translateX(-50%);
  border: 5px solid transparent;
}
#app-tooltip.above::after { top: 100%; border-top-color: #1a2e1a; }
#app-tooltip.below::after { bottom: 100%; border-bottom-color: #1a2e1a; }
/* Info icon used next to labels */
.tip-icon { display: inline-block; font-style: normal; font-size: 11px; font-weight: 700;
            color: #5da85d; border: 1px solid #5da85d; border-radius: 50%;
            width: 14px; height: 14px; line-height: 13px; text-align: center;
            margin-left: 4px; vertical-align: middle; cursor: default; }

/* ── Misc ─────────────────────────────────────────────────────────────────── */
.filter-bar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.filter-bar input[type=text] { width: 220px; }
.section-divider { border: none; border-top: 2px solid #e8f0e8; margin: 20px 0; }
.deleted-row td  { color: #bbb; text-decoration: line-through; }
.inactive-row td { color: #aaa; font-style: italic; }
.text-muted  { color: #8fa88f; font-size: 12px; }
.text-right  { text-align: right; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.gap-8 { display: flex; gap: 8px; }
.audit-row td { font-size: 12px; }
.audit-row .action { font-weight: 600; color: #1a2e1a; }
.audit-row .detail { color: #6b8f6b; font-style: italic; }
