:root {
  --navy: #0c2d48; --navy2: #145374; --accent: #0e8a9a; --accent-dark: #0a6f7c;
  --bg: #eef2f6; --card: #fff; --line: #dbe2ea; --text: #1b2733; --muted: #6b7a8a;
  --radius: 10px; --shadow: 0 1px 2px #0c2d4814, 0 2px 8px #0c2d480d;
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.45 "Segoe UI", system-ui, -apple-system, sans-serif; color: var(--text); background: var(--bg); }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
button { padding: 7px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); cursor: pointer; font-weight: 500; transition: background .12s, border-color .12s; }
button:hover { background: #f3f6f9; border-color: #b9c5d2; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
button.danger { color: #c92a2a; }
input, select, textarea { padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; max-width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid #0e8a9a55; border-color: var(--accent); }
.grow { flex: 1; }
.muted { color: var(--muted); }
.err { color: #c92a2a; min-height: 1.4em; margin: 4px 0; }
.f { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.f span { font-size: 13px; font-weight: 600; color: #46566a; }

.brand { display: flex; align-items: center; gap: 12px; }
.brand strong { display: block; font-size: 16px; letter-spacing: .2px; }
.brand small { display: block; font-size: 12px; opacity: .75; }
.logo { display: grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: 10px; font-weight: 700; letter-spacing: .5px;
  color: #fff; background: linear-gradient(135deg, var(--accent), #2bb3a3); box-shadow: 0 2px 6px #0003; }

#login { max-width: 380px; margin: 12vh auto; padding: 28px; background: var(--card); border-radius: 14px; box-shadow: 0 10px 40px #0c2d4826; border-top: 5px solid var(--accent); }
#login .brand { margin-bottom: 22px; color: var(--navy); }
#login button { width: 100%; padding: 10px; }

header { position: sticky; top: 0; z-index: 1; box-shadow: var(--shadow); }
.topbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 20px; color: #fff; background: linear-gradient(90deg, var(--navy), var(--navy2)); }
.topbar button { background: #ffffff1a; border-color: #ffffff33; color: #fff; padding: 5px 12px; }
.topbar button:hover { background: #ffffff33; }
#who { font-size: 13px; opacity: .85; margin-right: 6px; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 20px; background: var(--card); border-bottom: 1px solid var(--line); }
.toolbar h1 { font-size: 19px; margin: 0 6px; text-transform: capitalize; color: var(--navy); }
.seg { display: flex; }
.seg button { border-radius: 0; margin-left: -1px; }
.seg button:first-child { border-radius: 8px 0 0 8px; margin-left: 0; }
.seg button:last-child { border-radius: 0 8px 8px 0; }
.seg button.on { background: var(--navy); border-color: var(--navy); color: #fff; }
#search { width: 200px; }
.toolbar select { max-width: 190px; }

main { padding: 16px 20px 28px; max-width: 1500px; margin: 0 auto; }
#dow, #grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
#dow div { text-align: center; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); padding: 2px 0 6px; }
.day { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); min-height: 116px; padding: 6px; cursor: pointer; overflow: hidden; box-shadow: var(--shadow); transition: border-color .12s, transform .12s; }
.day:hover { border-color: var(--accent); transform: translateY(-1px); }
.day.other { background: transparent; box-shadow: none; color: #a3afbc; }
.day .num { display: flex; justify-content: space-between; align-items: center; font-weight: 600; font-size: 13px; margin-bottom: 3px; }
.day .num span:first-child { display: grid; place-items: center; min-width: 24px; height: 24px; border-radius: 12px; }
.day.today .num span:first-child { background: var(--accent); color: #fff; }
.day .count { font-weight: 600; font-size: 11px; background: #e4ebf2; color: #46566a; border-radius: 10px; padding: 1px 8px; }
.chip { --c: #868e96; font-size: 12px; padding: 2px 6px; margin-top: 3px; border-left: 4px solid var(--c); border-radius: 4px;
  background: color-mix(in srgb, var(--c) 13%, #fff); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.chip.off { text-decoration: line-through; opacity: .5; }
.chip.done { background: color-mix(in srgb, var(--c) 36%, #fff); }
.more { font-size: 12px; color: var(--muted); margin-top: 3px; }
#legend { display: flex; flex-wrap: wrap; gap: 6px 12px; margin-top: 16px; font-size: 13px; }
#legend .chip { display: inline-block; margin: 0; }

/* vederea pe saptamana */
#week { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 8px; align-items: start; }
.wday { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); min-height: 220px; cursor: pointer; overflow: hidden; box-shadow: var(--shadow); }
.wday:hover { border-color: var(--accent); }
.whead { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 6px; padding: 8px 10px; font-weight: 600; text-transform: capitalize; color: var(--navy); border-bottom: 1px solid var(--line); background: #f3f6f9; }
.wday.today .whead { background: var(--accent); color: #fff; }
.wdate { white-space: nowrap; font-weight: 400; font-size: 13px; opacity: .8; text-transform: none; }
.witem { --c: #868e96; margin: 6px; padding: 6px 8px; border-left: 5px solid var(--c); border-radius: 6px; background: color-mix(in srgb, var(--c) 11%, #fff); }
.witem.done { background: color-mix(in srgb, var(--c) 30%, #fff); }
.witem.off { opacity: .5; }
.witem.off .wpat { text-decoration: line-through; }
.wpat { font-weight: 600; overflow-wrap: break-word; }
.wtime { display: block; font-weight: 400; font-size: 12px; color: #46566a; }
.wproc { font-size: 13px; color: color-mix(in srgb, var(--c) 70%, #000); font-weight: 600; }
.wsec { font-size: 13px; color: #46566a; }
.wstat { font-size: 11px; color: var(--muted); margin-top: 2px; }
.wstat:empty { display: none; }
.wempty { padding: 14px 10px; font-size: 13px; color: #a3afbc; text-align: center; }

dialog { border: 0; border-radius: 14px; padding: 22px; width: min(780px, 96vw); max-height: 92vh; box-shadow: 0 20px 60px #0c2d4855; color: var(--text); }
dialog::backdrop { background: #0c2d4877; }
#dlg2 { width: min(500px, 96vw); }
.head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 14px; }
.head h2 { margin: 0; font-size: 19px; color: var(--navy); }
.card { --c: #868e96; border: 1px solid var(--line); border-left: 6px solid var(--c); border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; }
.card.off { background: #f7f9fb; }
.card.off .name { text-decoration: line-through; color: var(--muted); }
.card .top { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; }
.card .top .chip { margin: 0; }
.card .name { font-weight: 600; font-size: 16px; }
.card a { color: var(--accent-dark); }
.card .sub { font-size: 13px; color: #46566a; margin-top: 3px; }
.card .notes { white-space: pre-wrap; margin-top: 4px; }
.flags { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 8px; align-items: center; }
.flags label { display: flex; align-items: center; gap: 4px; cursor: pointer; }
.flags button { padding: 4px 10px; font-size: 13px; }
input[type=checkbox] { accent-color: var(--accent); width: 16px; height: 16px; }
.row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 6px; }
.row input:not([type=color]):not([type=checkbox]) { flex: 1; min-width: 120px; }
.row input[type=color] { padding: 2px; width: 40px; height: 36px; }
.row.inactive input { color: #a3afbc; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 14px; border-bottom: 1px solid var(--line); padding-bottom: 10px; }
.tabs button.on { background: var(--navy); border-color: var(--navy); color: #fff; }
hr { border: 0; border-top: 1px solid var(--line); margin: 12px 0; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
td, th { text-align: left; padding: 4px 6px; border-bottom: 1px solid var(--line); }
.result { padding: 8px 6px; border-bottom: 1px solid var(--line); cursor: pointer; }
.result:hover { background: #f3f6f9; }
#printhead { display: none; }

@media (max-width: 760px) {
  .topbar, .toolbar { padding: 8px 10px; }
  .brand strong { font-size: 14px; }
  #who { display: none; }
  main { padding: 10px 8px 20px; }
  .day { min-height: 62px; padding: 3px; }
  .day .count { display: none; }
  #grid .chip { font-size: 0; padding: 0; height: 5px; border-left-width: 0; background: var(--c); }
  .more { display: none; }
  #search { flex: 1 1 100%; order: 9; width: auto; }
  #week { grid-auto-flow: row; }
  .wday { min-height: 0; }
}
@media print {
  @page { size: A4 landscape; margin: 10mm; }
  body { background: #fff; font-size: 12px; }
  header, .noprint { display: none !important; }
  body:has(dialog[open]) #app { display: none; }
  dialog { position: static; width: auto; max-height: none; box-shadow: none; padding: 0; }
  main { padding: 0; max-width: none; }
  #printhead { display: flex; justify-content: space-between; align-items: baseline; font-size: 17px; color: var(--navy);
    border-bottom: 2px solid var(--navy); padding-bottom: 6px; margin-bottom: 10px; }
  .day, .wday, .card { box-shadow: none; break-inside: avoid; }
  .wday { min-height: 0; }
  .wday.today .whead { background: #f3f6f9; color: var(--navy); }
  .witem.off, .wempty { display: none; }
  .wpat { font-size: 13px; }
  .witem, .chip, .whead, .day { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
}
