/* ── CSS VARIABLES ─────────────────────────────── */
:root {
  --bg: #f0f0f0;
  --surface: #ffffff;
  --surface2: #f5f5f5;
  --border: #d0d0d0;
  --accent: #cc0000;
  --accent-dark: #990000;
  --accent2: #444444;
  --text: #1a1a1a;
  --text-muted: #666666;
  --shadow: 0 1px 4px rgba(0,0,0,0.12);
  --radius: 3px;
}

.header-logo {
  height: 48px;
  width: auto;
  object-fit: contain;
}

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

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ── HEADER ────────────────────────────────────── */
header {
  background: var(--accent);
  border-bottom: 3px solid var(--accent-dark);
  padding: 14px 40px;
  display: flex;
  align-items: center;
  gap: 18px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo-placeholder {
  width: 52px;
  height: 52px;
  border-radius: var(--radius);
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'DM Sans', sans-serif;
  color: var(--accent);
  font-size: 20px;
  font-weight: 700;
  flex-shrink: 0;
  border: 2px solid rgba(255,255,255,0.4);
  letter-spacing: -1px;
}

.header-text h1 {
  font-family: 'DM Sans', sans-serif;
  font-size: 1.3rem;
  color: #ffffff;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.header-text span {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.75);
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

#live-clock {
  margin-left: auto;
  font-size: 0.8rem;
  color: rgba(255,255,255,0.85);
  font-weight: 400;
  text-align: right;
}

#live-clock strong {
  display: block;
  font-size: 1.15rem;
  color: #ffffff;
  font-weight: 700;
}

/* ── MAIN GRID ─────────────────────────────────── */
main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 32px 40px;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  grid-template-rows: auto auto;
  gap: 24px;
}

.panel {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 0;
  animation: fadeUp 0.4s ease both;
  overflow: hidden;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.panel:nth-child(1) { animation-delay: 0.05s; }
.panel:nth-child(2) { animation-delay: 0.1s; }
.panel:nth-child(3) { animation-delay: 0.15s; grid-row: span 2; }
.panel:nth-child(4) { animation-delay: 0.2s; grid-column: span 2; }

.panel-title {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0;
  padding: 10px 16px;
  background: var(--accent2);
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-title::before {
  content: '';
  width: 3px;
  height: 12px;
  border-radius: 1px;
  background: var(--accent);
  flex-shrink: 0;
}

.panel-body {
  padding: 16px;
}

/* ── QUICK LINKS ───────────────────────────────── */
#links-panel {
  grid-column: span 2;
}

.links-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 8px;
  padding: 16px;
}

.link-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 12px 8px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface2);
  text-decoration: none;
  color: var(--text);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: all 0.15s ease;
}

.link-btn:hover {
  border-color: var(--accent);
  border-left: 3px solid var(--accent);
  background: #fff;
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(0,0,0,0.1);
  color: var(--accent);
}

.link-btn img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  border-radius: 2px;
}

.link-btn .link-label {
  text-align: center;
  line-height: 1.2;
}

.add-link-btn {
  border: 2px dashed var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 1.4rem;
  font-weight: 300;
}

.add-link-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: #fff;
}

/* ── TASK LIST ─────────────────────────────────── */
.task-input-row {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
  padding: 16px 16px 0 16px;
}

.task-input-row input {
  flex: 1;
  padding: 8px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface2);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.15s;
}

.task-input-row input:focus {
  border-color: var(--accent);
}

.btn-add-task {
  padding: 8px 14px;
  border-radius: var(--radius);
  border: none;
  background: var(--accent);
  color: white;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-add-task:hover {
  background: var(--accent-dark);
}

.task-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 260px;
  overflow-y: auto;
  padding: 8px 16px 16px 16px;
}

.task-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  background: var(--surface2);
  font-size: 0.83rem;
  transition: background 0.15s;
}

.task-item input[type="checkbox"] {
  accent-color: var(--accent);
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  cursor: pointer;
}

.task-item .task-text {
  flex: 1;
  transition: opacity 0.2s;
}

.task-item.done .task-text {
  text-decoration: line-through;
  opacity: 0.4;
}

.task-item.done {
  border-left-color: var(--border);
}

.task-delete {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0 2px;
  opacity: 0;
  transition: opacity 0.15s;
}

.task-item:hover .task-delete {
  opacity: 1;
}

/* ── NOTES ─────────────────────────────────────── */
#notes-panel textarea {
  width: 100%;
  min-height: 340px;
  resize: vertical;
  padding: 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  border-top: none;
  background: var(--surface2);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
  display: block;
}

#notes-panel textarea:focus {
  border-color: var(--accent);
}

.notes-saved {
  font-size: 0.72rem;
  color: var(--accent);
  padding: 4px 16px 8px;
  height: 22px;
  transition: opacity 0.3s;
}

/* ── CALENDAR ──────────────────────────────────── */
.cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding: 12px 16px 0 16px;
}

.cal-header button {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 28px;
  height: 28px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.15s;
  font-weight: 700;
}

.cal-header button:hover {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.cal-month-label {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text);
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  text-align: center;
  padding: 0 16px 16px 16px;
}

.cal-day-name {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-muted);
  padding: 4px 0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.cal-day {
  padding: 6px 2px;
  border-radius: var(--radius);
  font-size: 0.78rem;
  cursor: pointer;
  transition: all 0.12s;
  color: var(--text);
  font-weight: 500;
}

.cal-day:hover {
  background: var(--surface2);
  color: var(--accent);
}

.cal-day.empty {
  cursor: default;
}

.cal-day.today {
  background: var(--accent);
  color: white;
  font-weight: 700;
}

.cal-day.selected {
  background: var(--accent2);
  color: white;
}

/* ── MODAL ─────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  align-items: center;
  justify-content: center;
}

.modal-overlay.open {
  display: flex;
}

.modal {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 0;
  width: 360px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  overflow: hidden;
  border-top: 4px solid var(--accent);
}

.modal h2 {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 14px 20px;
  background: var(--accent2);
  color: white;
  margin-bottom: 0;
}

.modal label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
  color: var(--text-muted);
  padding: 0 20px;
}

.modal label:first-of-type {
  margin-top: 16px;
}

.modal input {
  width: 100%;
  padding: 8px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface2);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.85rem;
  outline: none;
  margin-bottom: 12px;
  box-sizing: border-box;
  padding-left: 20px;
  padding-right: 20px;
}

.modal input:focus {
  border-color: var(--accent);
}

.modal-btns {
  display: flex;
  gap: 0;
  margin-top: 4px;
  border-top: 1px solid var(--border);
}

.modal-btns button {
  flex: 1;
  padding: 12px;
  border-radius: 0;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
  border: none;
}

.btn-cancel {
  background: var(--surface2);
  color: var(--text-muted);
  border-right: 1px solid var(--border) !important;
}

.btn-cancel:hover {
  background: var(--border);
}

.btn-save {
  background: var(--accent);
  color: white;
}

.btn-save:hover {
  background: var(--accent-dark);
}

/* ── SCROLLBAR ─────────────────────────────────── */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }

/* ── RESPONSIVE ────────────────────────────────── */
@media (max-width: 900px) {
  main { grid-template-columns: 1fr 1fr; padding: 20px; }
  .panel:nth-child(3) { grid-row: auto; grid-column: span 2; }
  .panel:nth-child(4) { grid-column: span 2; }
  #links-panel { grid-column: span 2; }
}

@media (max-width: 600px) {
  main { grid-template-columns: 1fr; padding: 14px; }
  .panel:nth-child(3),
  .panel:nth-child(4),
  #links-panel { grid-column: span 1; }
  header { padding: 14px 20px; }
}
