:root {
  --primary: #2563eb;
  --green: #16a34a;
  --orange: #ea580c;
  --gray-100: #f3f4f6;
  --gray-700: #374151;
  font-family: system-ui, sans-serif;
}
body { margin: 0; background: var(--gray-100); color: var(--gray-700); }
button { cursor: pointer; background: var(--primary); color: white; border: none; padding: .5rem 1rem; border-radius: .5rem; }
input, select { padding: .5rem; border: 1px solid var(--gray-700); border-radius: .375rem; }
.table { width: 100%; border-collapse: collapse; margin-top: 1rem; }
.table th, .table td { padding: .5rem; border-bottom: 1px solid var(--gray-700); text-align: left; }
.row-green { background: #dcfce7; }
.row-orange { background: #ffedd5; }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; visibility: hidden; }
.modal[open] { visibility: visible; }
.modal-content { background: white; padding: 1rem; border-radius: .75rem; max-height: 80vh; overflow: auto; }
/* Oculta el modal per defecte */
simple-modal { display: none; }
.row-future { background: #ecfdf5; }   /* verd clar fosc */
.row-ongoing { background: #064e3b; color:white }  /* verd intens suau */
.row-past   { background: #fefce8; }   /* taronja pàl·lid */
button:disabled {
  opacity: 0.6;
  background: #e5e7eb !important;
  color: #888 !important;
  cursor: not-allowed !important;
  border-color: #d1d5db !important;
}
button.cancel {
  background: #868686;
  color: white;
}

.app-version-badge {
  position: fixed;
  left: .65rem;
  bottom: .5rem;
  z-index: 5000;
  color: #4b5563;
  font-size: .72rem;
  font-weight: 750;
  line-height: 1;
  letter-spacing: .01em;
  opacity: .78;
  pointer-events: none;
  user-select: text;
}


/* === Retro-Futurism App Theme Add-On === */
/* === Material 3/4 Inspired Subtle UI Theme Add-On === */

/* Import Roboto or Google Sans if you wish: */
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap');

body {
  background: #f6f6f7;
  color: #222;
  font-family: 'Roboto', Arial, sans-serif;
  font-size: 1.07em;
  letter-spacing: 0.01em;
  min-height: 100vh;
}

/* App Containers */
header, main, section {
  background: #fff;
  border-radius: 1.2em;
  box-shadow: 0 2px 8px 0 #1a1a1a08, 0 0.5px 0.7px #d5d5d5;
}

/* Header */
header {
  border-bottom: 1.7px solid #ececec;
  margin-bottom: 1.5em;
  padding-top: .8em;
  padding-bottom: .8em;
  box-shadow: 0 3px 10px 0 #3b82f63a;
}

/* Headings */
h1, h2, h3 {
  font-family: 'Roboto', Arial, sans-serif;
  font-weight: 700;
  color: #2e384d;
  letter-spacing: .04em;
  margin-bottom: 0.25em;
}

/* Buttons */
button, input[type="button"], input[type="submit"] {
  font-family: inherit;
  background: linear-gradient(90deg, #e3e3fd 5%, #d0eaff 95%);
  color: #224268;
  border: none;
  border-radius: 2.2em;
  font-weight: 500;
  font-size: 1.06em;
  padding: 0.50em 1.5em;
  margin: 0.15em 0.2em;
  cursor: pointer;
  box-shadow: 0 2px 7px 0 #dbeafe4c;
  outline: none;
  transition: background 0.13s, color 0.09s, box-shadow 0.13s;
}
button:hover, input[type="button"]:hover, input[type="submit"]:hover {
  background: linear-gradient(90deg, #caf0f8 5%, #dee2fc 100%);
  color: #002447;
  box-shadow: 0 4px 12px 0 #a5c6ee5e, 0 0 0 1px #b6d0ff99;
}

/* Inputs, selects, textareas */
input, select, textarea {
  background: #f3f6fa;
  color: #283347;
  border: 1.6px solid #d2dae3;
  border-radius: 1em;
  padding: 0.54em 1em;
  font-size: 1em;
  margin-bottom: 0.18em;
  transition: border 0.11s, background 0.09s;
}
input:focus, select:focus, textarea:focus {
  border: 2.1px solid #7ab2fa;
  background: #fafdff;
  outline: none;
}

/* Tables */
.table, table {
  width: 100%;
  xbackground: #fff;
  border-collapse: separate;
  border-spacing: 0 0.38em;
  box-shadow: 0 2px 16px #e1e7f81c;
  font-size: 1.01em;
  margin-bottom: 1em;
}
.table th, table th {
  xbackground: #e8f1fd;
  color: #23284a;
  border: none;
  font-weight: 600;
  padding: 1em 0.7em;
  border-radius: 0.95em 0.95em 0 0;
  letter-spacing: .04em;
}
.table td, table td {
  xbackground: #fafaff;
  color: #223248;
  border: none;
  padding: 0.76em 1em;
  border-radius: 0.7em;
}
.row-future  { background: #9ff597 !important; color: #2563eb !important; }
.row-ongoing { background: #058612 !important; color: #1e5245 !important; }
.row-past    { background: #ffedaa !important; color: #746149 !important; }
.row-paid    { background: #20c95b !important; color: #18643d !important; }
.row-unpaid  { background: #ffd036 !important; color: #b66800 !important; }
*/

/* Links */
a, a:visited {
  color: #386adf;
  text-decoration: underline;
  transition: color 0.13s;
}
a:hover {
  color: #1846a5;
}

/* Modal content (simple-modal or dialogs) */
.simple-modal .modal-content, .modal-content, dialog {
  background: #f5f7fb;
  border-radius: 1.3em;
  border: 1.7px solid #d6e4fa;
  box-shadow: 0 6px 32px 0 #e8e9fe88;
  padding: 2.1em 2.2em 1.5em 2.2em;
  min-width: 320px;
  min-height: 130px;
  color: #253046;
  font-size: 1.06em;
}

/* Misc UX refinements */
::-webkit-scrollbar {
  width: 10px;
  background: #f0f6ff;
}
::-webkit-scrollbar-thumb {
  background: #e3eafe;
  border-radius: 6px;
}
::-webkit-scrollbar-thumb:hover {
  background: #b1b7ce;
}

@media (max-width: 750px) {
  .modal-content { min-width: 95vw; }
  .table, table { font-size: 0.97em; }
  header, main, section { border-radius: 0.7em; }
}

input[type="checkbox"], input[type="radio"] {
  accent-color: #3b82f6;
}

/* Subtle transition for interactive states */
button, input, select, textarea, .table td, .table th {
  transition: background 0.13s, color 0.11s, box-shadow 0.13s, border 0.12s;
}


@keyframes spin-decelerate {
  0%   { transform: rotate(0deg); }
  100%  { transform: rotate(360deg); }   /* 4.5 turns very quickly */
  
}
@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.logo-spin {
  opacity: 0;
  display: block;
  margin-left: auto;
  margin-right: auto;
  transform-origin: 50% 50%;
  animation: spin-decelerate 0.75s linear 1 forwards,
             fade-in 0.8s cubic-bezier(.5,0,.7,1) 0.1s forwards;
}

/* Cohesive private app visual refresh. Public pages and projection/control screens do not opt in. */
html.app-private-root {
  min-height: 100%;
  background:
    linear-gradient(180deg, #e8f0fb 0%, #f5f8fc 48%, #eef4fb 100%);
}

body.app-private {
  --app-ink: #162033;
  --app-header: rgb(26, 77, 156);
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 0%, rgba(26, 77, 156, .14), transparent 30rem),
    radial-gradient(circle at 88% 10%, rgba(59, 130, 246, .10), transparent 28rem),
    linear-gradient(180deg, #e8f0fb 0%, #f5f8fc 48%, #eef4fb 100%) !important;
  color: var(--app-ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

body.app-private > header,
body.app-private header.app-header {
  border-radius: 0 !important;
  background: var(--app-header) !important;
  border: 0 !important;
  border-bottom: 1px solid rgba(255, 255, 255, .18) !important;
  box-shadow: 0 12px 30px rgba(15, 23, 42, .16) !important;
  backdrop-filter: blur(14px);
  color: #fff !important;
  margin-bottom: 0 !important;
}

body.app-private > header h1,
body.app-private header.app-header h1 {
  color: #fff !important;
  letter-spacing: 0;
}

body.app-private > header a,
body.app-private > header a:visited,
body.app-private header.app-header a,
body.app-private header.app-header a:visited {
  color: #fff !important;
}

body.app-private > header button:not(#debugDeleteAll),
body.app-private header.app-header button:not(#debugDeleteAll) {
  background: rgba(255, 255, 255, .12) !important;
  color: #fff !important;
  border: 1px solid rgba(255, 255, 255, .26) !important;
  box-shadow: none !important;
}

body.app-private > header button:not(#debugDeleteAll):hover,
body.app-private header.app-header button:not(#debugDeleteAll):hover {
  background: rgba(255, 255, 255, .20) !important;
  color: #fff !important;
}

body.app-private #header-user {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  padding: .15rem .15rem .15rem .75rem;
  margin-left: .25rem;
  border-left: 1px solid rgba(255, 255, 255, .34);
  background: transparent;
  color: rgba(255, 255, 255, .86) !important;
  cursor: default;
  font-size: .92rem;
  font-weight: 650;
  user-select: text;
}

body.app-private > header + section {
  margin-top: 1rem !important;
}

body.app-private .app-breadcrumb {
  display: flex;
  align-items: center;
  gap: .5rem;
  min-height: 2.45rem;
  padding: .45rem clamp(1rem, 3vw, 2rem);
  margin: 0 0 1rem;
  background: rgba(255, 255, 255, .62);
  border-bottom: 1px solid rgba(100, 116, 139, .16);
  box-shadow: 0 8px 20px rgba(15, 23, 42, .045);
  backdrop-filter: blur(10px);
  color: #64748b;
  font-size: .94rem;
  font-weight: 750;
  overflow-x: auto;
  white-space: nowrap;
}

body.app-private .app-breadcrumb a,
body.app-private .app-breadcrumb .current {
  display: inline-flex;
  align-items: center;
  gap: .38rem;
  min-height: 1.75rem;
  color: #334155;
  text-decoration: none;
}

body.app-private .app-breadcrumb a:hover {
  color: #1d4ed8;
  text-decoration: none;
}

body.app-private .app-breadcrumb .current {
  color: #0f172a;
}

body.app-private .app-breadcrumb .separator {
  color: #94a3b8;
  font-weight: 900;
}

body.app-private .app-breadcrumb-home {
  display: inline-grid;
  place-items: center;
  width: 1.45rem;
  height: 1.45rem;
  border-radius: 999px;
  background: rgba(37, 99, 235, .10);
  color: #1d4ed8;
  font-size: .95rem;
  line-height: 1;
}
