:root {
  --navy: #0f1a30;
  --navy-light: #16233f;
  --cream: #faf6ee;
  --cream-dim: #f0ead9;
  --orange: #e6a13c;
  --orange-dark: #cc8a28;
  --ink: #1c2333;
  --muted: #7a8296;
  --border: #e4ddc9;
  --danger: #c25450;
  --success: #4c8c5a;
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--navy);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

button {
  font-family: inherit;
  cursor: pointer;
}

input, select, textarea {
  font-family: inherit;
  font-size: 14px;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-header {
  padding: 22px 28px 10px;
  color: var(--cream);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.app-header h1 {
  font-size: 20px;
  letter-spacing: 0.02em;
  margin: 0;
  font-weight: 700;
}

.app-header .subtitle {
  font-size: 12px;
  color: #9aa4bd;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.tab-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 20px;
  overflow-x: auto;
}

.tab-btn {
  border: none;
  background: transparent;
  color: #9aa4bd;
  padding: 10px 16px;
  border-radius: 10px 10px 0 0;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tab-btn .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.tab-btn.active {
  background: var(--cream);
  color: var(--ink);
}

.tab-btn:not(.active):hover {
  background: rgba(255,255,255,0.06);
  color: var(--cream);
}

.tab-wrap {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.tab-edit {
  border: none;
  background: transparent;
  color: #6a7396;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  font-size: 11px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tab-edit:hover { background: rgba(255,255,255,0.1); color: var(--cream); }

.tab-add {
  border: 1px dashed #3a4467;
  background: transparent;
  color: #9aa4bd;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-left: 4px;
}
.tab-add:hover { border-color: var(--orange); color: var(--orange); }

.content {
  flex: 1;
  background: var(--cream);
  border-radius: 18px 18px 0 0;
  padding: 26px 28px 60px;
  margin-top: 4px;
}

.panel {
  max-width: 1180px;
  margin: 0 auto;
}

.row {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

.col-main { flex: 1; min-width: 0; }
.col-chat { width: 380px; flex-shrink: 0; }
.col-side { width: 300px; flex-shrink: 0; display: flex; flex-direction: column; gap: 16px; }

.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 16px;
}

.card-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 10px;
}

.filters {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
}

.filter-btn {
  border: 1px solid var(--border);
  background: #fff;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}
.filter-btn.active {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.gcal-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--muted);
}

.btn {
  border: none;
  border-radius: 9px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 700;
  background: var(--orange);
  color: #24160a;
}
.btn:hover { background: var(--orange-dark); }
.btn.secondary {
  background: var(--ink);
  color: #fff;
}
.btn.ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--ink);
}
.btn.danger {
  background: transparent;
  color: var(--danger);
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.task-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.task-form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
}
.task-form-row.row-title > div { flex: 1 1 100%; }
.task-form-row.row-fields > div { flex: 1 1 130px; }
.task-form-row.row-fields > div:last-child { flex: 0 0 auto; }
.task-form label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  display: block;
  margin-bottom: 4px;
  font-weight: 700;
}
.task-form input, .task-form select {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--cream-dim);
}

.task-list { display: flex; flex-direction: column; gap: 8px; }

.task-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
}
.task-item.done {
  opacity: 0.5;
}
.task-item.done .task-title { text-decoration: line-through; }

.task-check {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 2px solid var(--border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
}
.task-check.checked {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
  font-size: 13px;
}

.task-title { font-weight: 600; font-size: 14px; }
.task-meta { font-size: 12px; color: var(--muted); display: flex; gap: 10px; margin-top: 2px; flex-wrap: wrap; }

.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  color: #fff;
}
.tag svg { flex-shrink: 0; display: block; }

.task-actions { margin-left: auto; display: flex; gap: 6px; }
.icon-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 12px;
}
.icon-btn:hover { background: var(--cream-dim); color: var(--ink); }

.empty {
  color: var(--muted);
  font-size: 13px;
  padding: 24px 0;
  text-align: center;
}
.empty.agenda-empty-day {
  padding: 10px 0;
  text-align: left;
  font-size: 12px;
}

.chat-panel {
  background: var(--ink);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  height: 640px;
  overflow: hidden;
}
.chat-header {
  padding: 16px 18px;
  color: var(--cream);
  border-bottom: 1px solid #2a3352;
}
.chat-header .name { font-weight: 700; font-size: 14px; }
.chat-header .role { font-size: 11px; color: #8b93ad; text-transform: uppercase; letter-spacing: 0.06em; margin-top: 2px; }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.msg {
  max-width: 88%;
  padding: 10px 13px;
  border-radius: 12px;
  font-size: 13.5px;
  line-height: 1.45;
  white-space: pre-wrap;
}
.msg.user {
  align-self: flex-end;
  background: var(--orange);
  color: #24160a;
}
.msg.assistant {
  align-self: flex-start;
  background: #232c48;
  color: #eef0f7;
}
.msg.pending {
  align-self: flex-start;
  color: #8b93ad;
  font-size: 12px;
  font-style: italic;
}

.chat-input-row {
  padding: 12px;
  border-top: 1px solid #2a3352;
  display: flex;
  gap: 8px;
}
.chat-input-row textarea {
  flex: 1;
  resize: none;
  border-radius: 9px;
  border: 1px solid #2a3352;
  background: #16233f;
  color: #eef0f7;
  padding: 9px 11px;
  font-size: 13px;
  min-height: 40px;
  max-height: 120px;
}
.chat-input-row button {
  background: var(--orange);
  border: none;
  border-radius: 9px;
  padding: 0 16px;
  font-weight: 700;
  color: #24160a;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15,26,48,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}
.modal {
  background: #fff;
  border-radius: 16px;
  padding: 22px;
  width: 340px;
}
.modal h3 { margin: 0 0 14px; font-size: 15px; }
.modal input, .modal select {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 10px;
  background: var(--cream-dim);
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 6px;
}

.swatches { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.swatch {
  width: 24px; height: 24px; border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
}
.swatch.selected { border-color: var(--ink); }

@media (max-width: 900px) {
  .row { flex-direction: column; }
  .col-chat { width: 100%; }
  .col-side { width: 100%; }
  .chat-panel { height: 420px; }
}

/* ---- login page ---- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--navy);
}
.login-card {
  background: var(--cream);
  border-radius: 18px;
  padding: 32px 30px;
  width: 320px;
}
.login-brand {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--orange-dark);
  margin-bottom: 6px;
}
.login-card h1 {
  font-size: 19px;
  margin: 0 0 18px;
}
.login-card label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  display: block;
  margin: 12px 0 4px;
  font-weight: 700;
}
.login-card input {
  width: 100%;
  padding: 10px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--cream-dim);
}
.login-error {
  color: var(--danger);
  font-size: 13px;
  background: #fbeceb;
  border-radius: 8px;
  padding: 8px 10px;
  margin-top: 4px;
}

/* ---- logout link in header ---- */
.logout-link {
  align-self: center;
  font-size: 12px;
  color: #9aa4bd;
  text-decoration: none;
  border: 1px solid #2a3352;
  border-radius: 999px;
  padding: 6px 14px;
}
.logout-link:hover { color: var(--cream); border-color: var(--orange); }

/* ---- search box (Finalizate) ---- */
.search-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--cream-dim);
}

/* ---- inline edit row ---- */
.task-item.editing { align-items: flex-start; padding: 14px; }

/* ---- priority / overdue ---- */
.task-item.overdue { border-color: var(--danger); background: #fdf3f2; }
.urgent-tag {
  background: var(--danger);
  color: #fff;
}
.overdue-tag {
  background: #7a1f1c;
  color: #fff;
}
.overdue-card {
  border-color: var(--danger);
  background: #fdf3f2;
}
.deleted-tag {
  background: #6b6f7d;
  color: #fff;
}
.form-error {
  color: var(--danger);
  font-size: 12px;
  margin-top: 6px;
}
.form-error:empty { display: none; }
.current-attachment {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
}
.remove-attachment-check {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--muted);
  font-weight: normal;
  cursor: pointer;
}
.attachment-tag {
  background: var(--ink);
  color: #fff;
  cursor: pointer;
}
.attachment-tag:hover { opacity: 0.85; }
.task-item.deleted-item { opacity: 0.85; }
.hint-text {
  font-size: 12px;
  color: var(--muted);
  margin: -4px 0 10px;
}
.overdue-card-title {
  color: var(--danger);
}

/* ---- header actions ---- */
.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.export-link {
  align-self: center;
  font-size: 12px;
  color: #9aa4bd;
  text-decoration: none;
  border: 1px solid #2a3352;
  border-radius: 999px;
  padding: 6px 14px;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
}
.export-link:hover { color: var(--cream); border-color: var(--orange); }

/* ---- daily message ---- */
.daily-message-card {
  background: linear-gradient(135deg, #1c2333, #2a3352);
  color: var(--cream);
  border: none;
}
.daily-message-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--orange);
  font-weight: 700;
  margin-bottom: 8px;
}
.daily-message-text {
  font-size: 14px;
  line-height: 1.6;
  font-style: italic;
}
.daily-message-retry {
  color: var(--orange);
  margin-top: 8px;
  padding: 2px 0;
  font-size: 12px;
  font-style: normal;
}
.daily-message-retry:hover { color: var(--cream); }

/* ---- calendar ---- */
.calendar-card { padding: 16px 18px; }
.calendar-card.compact { padding: 12px 12px; }
.calendar-card.compact .calendar-title { font-size: 12px; }
.calendar-card.compact .cal-dow { font-size: 9px; padding: 2px 0; }
.calendar-card.compact .cal-cell { font-size: 10px; border-radius: 6px; }
.calendar-card.compact .cal-daynum { line-height: 1; }
.calendar-card.compact .calendar-grid { gap: 3px; }
.calendar-card.compact .cal-dot { width: 4px; height: 4px; margin-top: 1px; }
.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.calendar-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: capitalize;
}
.res-month-title {
  cursor: pointer;
  padding: 2px 8px;
  border-radius: 6px;
}
.res-month-title:hover { background: var(--border); }
.res-month-title.cal-selected { background: var(--ink); color: #fff; }
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.cal-dow {
  font-size: 10px;
  text-transform: uppercase;
  color: var(--muted);
  text-align: center;
  padding: 4px 0;
  font-weight: 700;
}
.cal-cell {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  cursor: pointer;
  position: relative;
  font-size: 12px;
}
.cal-cell:hover { background: var(--cream-dim); }
.cal-cell.empty-cell { cursor: default; }
.cal-cell.empty-cell:hover { background: transparent; }
.cal-today { background: var(--cream-dim); font-weight: 700; }
.cal-selected { background: var(--ink); color: #fff; }
.cal-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--orange);
  margin-top: 2px;
}
.cal-selected .cal-dot { background: var(--orange); }
.selected-date-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--ink);
  color: #fff;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
}
.selected-date-chip .icon-btn { color: #fff; padding: 0 0 0 4px; }

/* ---- agenda ---- */
.agenda-day { margin-bottom: 18px; }
.agenda-day:last-child { margin-bottom: 0; }
.agenda-day-header {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-transform: capitalize;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

/* ---- fonduri ---- */
.fund-stocks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
  margin-bottom: 6px;
}
.fund-stock-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--cream-dim);
}
.fund-stock-row label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  flex: 1 1 auto;
}
.fund-stock-input-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
}
.fund-stock-input-wrap input {
  width: 68px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  text-align: right;
}
.fund-stock-input-wrap span {
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
}
.fund-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.fund-table th, .fund-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
.fund-table th {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
}
.fund-base-input {
  width: 110px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
}
.fund-pos { color: var(--success); font-weight: 700; }
.fund-neg { color: var(--danger); font-weight: 700; }

/* ---- rezervari etrip ---- */
.res-summary-table td:nth-child(2),
.res-summary-table td:nth-child(3) {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.res-total-row td {
  font-weight: 700;
  border-top: 2px solid var(--border);
  border-bottom: none;
}
.res-sediu-wrap {
  max-height: 420px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.res-sediu-table {
  font-size: 13px;
}
.res-sediu-table thead th {
  position: sticky;
  top: 0;
  background: var(--cream);
  z-index: 1;
}
.res-sediu-table td:nth-child(2),
.res-sediu-table td:nth-child(3),
.res-sediu-table th:nth-child(2),
.res-sediu-table th:nth-child(3) {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.res-sediu-table tr.res-sediu-empty td {
  color: var(--muted);
}
.fund-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 16px;
  flex-wrap: wrap;
}
.fund-updated {
  font-size: 12px;
  color: var(--muted);
}
