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

:root {
  --bg:      #ffffff;
  --bg2:     #f7f6f3;
  --bg3:     #f1efe8;
  --border:  rgba(0,0,0,0.1);
  --border2: rgba(0,0,0,0.22);
  --text:    #1a1a1a;
  --text2:   #5f5e5a;
  --text3:   #888780;
  --radius:  8px;
  --radius-lg: 12px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:      #1c1c1c;
    --bg2:     #242424;
    --bg3:     #2c2c2a;
    --border:  rgba(255,255,255,0.1);
    --border2: rgba(255,255,255,0.2);
    --text:    #f0efe8;
    --text2:   #b4b2a9;
    --text3:   #888780;
  }
}

body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: var(--bg3); color: var(--text); font-size: 15px; line-height: 1.6; }

.app-header { background: var(--bg); border-bottom: 0.5px solid var(--border); padding: 0 1.5rem; display: flex; align-items: center; justify-content: space-between; height: 52px; position: sticky; top: 0; z-index: 100; }
.app-header h1 { font-size: 15px; font-weight: 500; }
.app-header nav { display: flex; gap: 8px; align-items: center; }

.main { max-width: 1100px; margin: 0 auto; padding: 1.5rem 1rem 4rem; }

.btn { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; padding: 6px 14px; border-radius: var(--radius); border: 0.5px solid var(--border2); background: var(--bg); color: var(--text); cursor: pointer; transition: background 0.15s; text-decoration: none; }
.btn:hover { background: var(--bg2); }
.btn.primary { background: #1a1a1a; color: #fff; border-color: #1a1a1a; }
.btn.primary:hover { background: #333; }
.btn.danger { background: #fcebeb; color: #a32d2d; border-color: #f09595; }
.btn.danger:hover { background: #f7c1c1; }
.btn.sm { font-size: 12px; padding: 4px 10px; }

.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: 12px; font-weight: 500; color: var(--text2); margin-bottom: 4px; }
input, select, textarea { width: 100%; padding: 8px 10px; border: 0.5px solid var(--border2); border-radius: var(--radius); background: var(--bg); color: var(--text); font-size: 14px; font-family: inherit; outline: none; transition: border-color 0.15s; }
input:focus, select:focus, textarea:focus { border-color: #378ADD; }
textarea { min-height: 80px; resize: vertical; }

.card { background: var(--bg); border: 0.5px solid var(--border); border-radius: var(--radius-lg); padding: 1.25rem; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { font-size: 11px; font-weight: 500; color: var(--text3); text-transform: uppercase; letter-spacing: .05em; padding: 8px 12px; border-bottom: 0.5px solid var(--border); text-align: left; }
td { padding: 10px 12px; border-bottom: 0.5px solid var(--border); vertical-align: top; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg2); }

.type-badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 500; border-radius: 4px; padding: 2px 7px; white-space: nowrap; }

.overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 200; align-items: center; justify-content: center; padding: 1rem; }
.overlay.open { display: flex; }
.modal { background: var(--bg); border: 0.5px solid var(--border2); border-radius: var(--radius-lg); width: 100%; max-width: 540px; max-height: 90vh; overflow-y: auto; }
.modal-head { padding: 16px 20px 14px; border-bottom: 0.5px solid var(--border); display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; background: var(--bg); z-index: 1; }
.modal-head h2 { font-size: 15px; font-weight: 500; }
.modal-close { background: none; border: none; cursor: pointer; font-size: 18px; color: var(--text3); padding: 0 2px; }
.modal-close:hover { color: var(--text); }
.modal-body { padding: 20px; }
.modal-footer { padding: 12px 20px; border-top: 0.5px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

.alert { font-size: 13px; padding: 10px 14px; border-radius: var(--radius); margin-bottom: 1rem; }
.alert.success { background: #eaf3de; color: #27500a; }
.alert.error { background: #fcebeb; color: #a32d2d; }

.flex { display: flex; }
.gap-8 { gap: 8px; }
.mt-1 { margin-top: 1rem; }
.mb-1 { margin-bottom: 1rem; }
.text-sm { font-size: 13px; }
.text-muted { color: var(--text3); }

/* Calendário */
.cal-legend { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-bottom: 1.5rem; }
.cal-legend-item { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text2); }
.cal-legend-dot { width: 10px; height: 10px; border-radius: 2px; flex-shrink: 0; }
.cal-section-title { font-size: 13px; font-weight: 500; color: var(--text); margin: 1.5rem 0 6px; border-left: 2px solid var(--border2); padding-left: 8px; }
.cal-hdr { display: grid; grid-template-columns: repeat(7, minmax(0,1fr)); gap: 4px; margin-bottom: 4px; }
.cal-hdr-cell { font-size: 10px; font-weight: 500; color: var(--text3); text-align: center; text-transform: uppercase; letter-spacing: .05em; padding: 2px 0; }
.cal-hdr-cell.wknd { color: var(--text2); }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0,1fr)); gap: 4px; margin-bottom: 4px; }
.cal-cell { border: 0.5px solid var(--border); border-radius: var(--radius); background: var(--bg); padding: 5px 5px 7px; min-height: 90px; cursor: pointer; transition: border-color 0.15s; }
.cal-cell:hover { border-color: var(--border2); }
.cal-cell.empty { background: transparent; border-color: transparent; cursor: default; }
.cal-cell.empty:hover { border-color: transparent; }
.cal-cell.wknd { background: var(--bg2); }
.cal-day-num { font-size: 11px; font-weight: 500; color: var(--text3); margin-bottom: 4px; }
.cal-pill { font-size: 10px; font-weight: 500; border-radius: 3px; padding: 2px 4px; margin-bottom: 2px; line-height: 1.4; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-reserved-tag { display: inline-block; background: #FAEEDA; color: #633806; font-size: 9px; border-radius: 2px; padding: 1px 3px; margin-left: 2px; }
.cal-divider { border: none; border-top: 0.5px dashed var(--border); margin: 3px 0; }

/* Popup */
.popup-date { font-size: 14px; font-weight: 500; }
.popup-sub { font-size: 12px; color: var(--text2); margin-top: 2px; }
.popup-item { display: flex; gap: 8px; margin-bottom: 8px; font-size: 13px; }
.popup-dot { width: 8px; height: 8px; border-radius: 2px; flex-shrink: 0; margin-top: 4px; }
.popup-time { font-size: 11px; color: var(--text3); }
.group-tag { display: inline-block; background: #FBEAF0; color: #72243E; font-size: 9px; border-radius: 2px; padding: 1px 3px; margin-left: 3px; }

/* Login */
.login-wrap { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 1rem; }
.login-box { width: 100%; max-width: 360px; }
.login-title { font-size: 20px; font-weight: 500; margin-bottom: 0.5rem; text-align: center; }
.login-sub { font-size: 13px; color: var(--text3); text-align: center; margin-bottom: 1.5rem; }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 0.5px solid var(--border); margin-bottom: 1.5rem; }
.tab-btn { border-radius: var(--radius) var(--radius) 0 0; border-bottom: none; color: var(--text2); }
.tab-btn.active { background: var(--bg2); color: var(--text); border-bottom: 2px solid var(--text); }
