:root {
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  color: #10233f;
  background: #ffffff;
  --ink: #10233f;
  --muted: #64748b;
  --line: #dbe5f0;
  --paper: #ffffff;
  --soft: #f3f7fb;
  --blue: #1769c2;
  --blue-dark: #0d4f96;
  --blue-soft: #eaf3ff;
  --red: #c0362c;
  --amber: #b9700f;
}

* { box-sizing: border-box; }
html { background: #fff; }
body { margin: 0; background: #fff; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible {
  outline: 2px solid #4b9ae9;
  outline-offset: 2px;
}
.hidden { display: none !important; }

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 220px minmax(500px, 1fr) 360px;
  background: var(--paper);
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid var(--line);
  background: var(--soft);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 28px; }
.brand div { display: flex; flex-direction: column; }
.brand strong { font-size: 14px; }
.brand small { font-size: 11px; color: var(--muted); }
.monogram {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  background: var(--blue);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  border-radius: 6px;
}
.sidebar nav { display: flex; flex-direction: column; gap: 4px; }
.nav {
  height: 42px;
  display: grid;
  grid-template-columns: 22px 1fr auto;
  align-items: center;
  text-align: left;
  border: 0;
  background: transparent;
  color: #52657d;
  padding: 0 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 650;
}
.nav svg { width: 17px; }
.nav b { font-size: 10px; background: #dce8f5; padding: 2px 6px; border-radius: 9px; }
.nav:hover { color: var(--blue); background: #edf4fb; }
.nav.active { background: #dcecff; color: var(--blue-dark); }
.sidebar footer {
  margin-top: auto;
  border-top: 1px solid var(--line);
  padding: 16px 8px 0;
  display: grid;
  grid-template-columns: 10px 1fr auto;
  align-items: center;
  gap: 9px;
}
.sidebar footer > span { width: 8px; height: 8px; border-radius: 50%; background: #98a2b3; }
.sidebar footer > span.connected { background: #138a55; box-shadow: 0 0 0 3px #d5f3e4; }
.sidebar footer div { display: flex; flex-direction: column; }
.sidebar footer strong { font-size: 11px; }
.sidebar footer small { font-size: 9px; color: var(--muted); }

.workspace { min-width: 0; padding: 28px 36px 70px; max-width: 1180px; width: 100%; margin: auto; }
.topbar { min-height: 56px; display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.topbar small { text-transform: capitalize; color: var(--muted); font-size: 11px; }
.topbar h1 { font-size: 23px; margin: 4px 0 0; letter-spacing: 0; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.top-actions > span { font-size: 10px; color: var(--muted); margin-right: 5px; white-space: nowrap; }
.icon {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  background: #fff;
  color: #52657d;
  border-radius: 6px;
}
.icon:hover { color: var(--blue); border-color: #a8c9eb; }
.icon svg { width: 16px; }
.spinning svg { animation: spin .8s linear infinite; }
.icon.notification-on { color: #fff; background: var(--blue); border-color: var(--blue); }
@keyframes spin { to { transform: rotate(360deg); } }

.primary, .secondary, .text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  border-radius: 6px;
  padding: 0 14px;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}
.primary { border: 1px solid var(--blue); background: var(--blue); color: #fff; }
.primary:hover { background: var(--blue-dark); }
.secondary { border: 1px solid var(--line); background: #fff; color: var(--ink); }
.secondary:hover { border-color: #9cc1e8; color: var(--blue-dark); }
.text-button { border: 0; background: transparent; color: var(--blue); padding-inline: 6px; white-space: nowrap; }
.text-button svg, .secondary svg { width: 14px; }

.banner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 13px;
  background: var(--blue-soft);
  border-left: 3px solid var(--blue);
  padding: 13px 15px;
  margin-bottom: 25px;
}
.banner > svg { width: 19px; color: var(--blue); }
.banner div { display: flex; flex-direction: column; }
.banner strong { font-size: 13px; }
.banner span { font-size: 11px; color: #52657d; }
.view { display: none; }
.view.active { display: block; animation: reveal .18s ease-out; }
@keyframes reveal { from { opacity: 0; transform: translateY(3px); } }

.metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  margin-bottom: 32px;
}
.metrics > div { padding: 17px 18px 16px 0; margin-right: 18px; border-right: 1px solid var(--line); min-width: 0; }
.metrics > div:last-child { border: 0; margin: 0; }
.metrics span { display: block; font-size: 10px; color: var(--muted); margin-bottom: 7px; }
.metrics strong { font-size: 25px; line-height: 1; letter-spacing: 0; }
.metrics .danger { color: var(--red); }
.metrics .small-value { display: block; font-size: 13px; line-height: 1.4; overflow-wrap: anywhere; }
.section-title { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin: 0 0 12px; }
.section-title h2 { font-size: 16px; margin: 0 0 4px; }
.section-title p { font-size: 11px; line-height: 1.45; color: var(--muted); margin: 0; }
.today-agenda { margin-top: 38px; }

.rows { border-top: 1px solid var(--line); }
.action-row {
  display: grid;
  grid-template-columns: 7px minmax(190px, 1.1fr) minmax(180px, 1fr) 105px auto;
  gap: 13px;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.priority { width: 4px; height: 36px; background: #98a2b3; border-radius: 2px; }
.priority.alta { background: var(--red); }
.priority.media { background: var(--amber); }
.priority.bassa { background: var(--blue); }
.action-main, .action-detail { min-width: 0; }
.action-main strong { display: block; font-size: 13px; line-height: 1.35; margin-bottom: 4px; overflow-wrap: anywhere; }
.action-main span, .action-detail span { display: block; font-size: 10px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.action-detail p { font-size: 11px; line-height: 1.4; margin: 0; overflow-wrap: anywhere; }
.due { font-size: 10px; font-weight: 700; color: #475569; }
.due.overdue { color: var(--red); }
.row-actions { display: flex; gap: 5px; }
.row-actions button, .row-actions a {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  background: #fff;
  color: #52657d;
  border-radius: 5px;
}
.row-actions svg { width: 14px; }
.empty { padding: 24px 0; border-bottom: 1px solid var(--line); font-size: 12px; color: var(--muted); }

.agenda, .mail-list { border-top: 1px solid var(--line); }
.agenda-item {
  display: grid;
  grid-template-columns: 58px 1fr auto;
  gap: 12px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
  align-items: center;
}
.agenda-item time { font-size: 11px; color: var(--blue); font-weight: 750; }
.agenda-item .agenda-icon { width: 32px; height: 32px; display: grid; place-items: center; background: #fff4df; color: var(--amber); border-radius: 6px; }
.agenda-icon svg { width: 15px; }
.agenda-item strong, .mail-item strong { display: block; font-size: 12px; line-height: 1.35; overflow-wrap: anywhere; }
.agenda-item span, .mail-item span { font-size: 10px; color: var(--muted); }
.agenda-item > button { opacity: .65; }
.agenda-item:hover > button { opacity: 1; }

.mail-item {
  display: grid;
  grid-template-columns: 9px minmax(0, 1fr) auto;
  gap: 11px;
  align-items: center;
  width: 100%;
  min-width: 0;
  text-align: left;
  padding: 13px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
}
.mail-item:hover { background: #f8fbff; }
.mail-item > div { min-width: 0; }
.mail-item .unread { width: 7px; height: 7px; border-radius: 50%; background: var(--blue); }
.mail-item.read .unread { background: transparent; }
.mail-item .sender, .mail-item .subject { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-item .sender { font-weight: 700; margin-bottom: 3px; }
.mail-item .subject { font-weight: 500; }
.mail-item time { font-size: 9px; color: var(--muted); white-space: nowrap; }
.mail-item p { grid-column: 2 / 4; font-size: 10px; color: var(--muted); margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.calendar-legend { display: flex; align-items: center; gap: 14px; color: var(--muted); font-size: 10px; white-space: nowrap; }
.calendar-legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--blue); }
.legend-dot.deadline { background: var(--amber); }
.calendar { border-left: 1px solid var(--line); margin: 24px 0 0 74px; }
.calendar-day { position: relative; padding: 0 0 30px 27px; }
.calendar-day::before { content: ""; position: absolute; left: -5px; top: 4px; width: 9px; height: 9px; background: var(--blue); border-radius: 50%; box-shadow: 0 0 0 4px #fff; }
.calendar-day.deadline::before { background: var(--amber); }
.calendar-day > time { position: absolute; right: calc(100% + 17px); top: 2px; width: 58px; text-align: right; font-size: 10px; color: var(--muted); font-weight: 700; }
.entry-type { display: inline-flex; align-items: center; gap: 5px; color: var(--blue); font-size: 9px; font-weight: 750; text-transform: uppercase; margin-bottom: 5px; }
.deadline .entry-type { color: var(--amber); }
.entry-type svg { width: 12px; }
.calendar-day h3 { font-size: 13px; line-height: 1.35; margin: 0 0 5px; overflow-wrap: anywhere; }
.calendar-day p { font-size: 10px; line-height: 1.45; color: var(--muted); margin: 0 0 3px; overflow-wrap: anywhere; }
.calendar-day > button, .calendar-actions { margin-top: 8px; }
.calendar-actions { display: flex; flex-wrap: wrap; gap: 7px; }

.segmented { display: flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; flex-shrink: 0; }
.segmented button { border: 0; border-right: 1px solid var(--line); background: #fff; padding: 8px 11px; font-size: 10px; color: var(--muted); }
.segmented button:last-child { border: 0; }
.segmented button.active { background: var(--blue); color: #fff; }
.table-wrap { overflow: auto; border-top: 1px solid var(--line); -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; min-width: 680px; }
th { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); font-size: 9px; color: var(--muted); text-transform: uppercase; }
td { padding: 13px 8px; border-bottom: 1px solid var(--line); font-size: 11px; }
.tag { background: var(--blue-soft); color: var(--blue-dark); padding: 3px 6px; border-radius: 4px; font-size: 9px; }

.agent { position: sticky; top: 0; height: 100vh; border-left: 1px solid var(--line); background: var(--soft); display: flex; flex-direction: column; }
.agent > header { height: 76px; border-bottom: 1px solid var(--line); padding: 0 19px; display: flex; align-items: center; justify-content: space-between; }
.agent > header > div { display: grid; grid-template-columns: 12px 1fr; column-gap: 8px; }
.agent header strong { font-size: 12px; }
.agent header small { grid-column: 2; font-size: 10px; color: var(--muted); }
.presence { width: 8px; height: 8px; border-radius: 50%; background: #138a55; margin-top: 4px; box-shadow: 0 0 0 3px #d5f3e4; }
.messages { flex: 1; overflow: auto; padding: 18px; }
.message { max-width: 92%; font-size: 12px; line-height: 1.5; white-space: pre-wrap; margin-bottom: 13px; }
.message.user { margin-left: auto; background: var(--blue); color: #fff; padding: 9px 11px; border-radius: 7px; }
.message.pending { color: var(--muted); }
.prompts { display: flex; gap: 5px; padding: 0 14px 9px; overflow-x: auto; }
.prompts button { white-space: nowrap; border: 1px solid #cad9e8; background: #fff; border-radius: 5px; padding: 6px 8px; color: #52657d; font-size: 9px; }
.command { margin: 0 13px 15px; padding: 8px 8px 8px 11px; background: #fff; border: 1px solid #cad9e8; border-radius: 8px; display: grid; grid-template-columns: 1fr auto; align-items: end; }
.command textarea { border: 0; outline: 0; resize: none; background: transparent; padding: 6px 0; color: var(--ink); font-size: 12px; max-height: 120px; min-width: 0; }
.command button { width: 31px; height: 31px; display: grid; place-items: center; border: 0; border-radius: 6px; background: var(--blue); color: #fff; }
.command svg { width: 15px; }
.mobile { display: none; }

.login { position: fixed; inset: 0; background: #fff; display: grid; place-items: center; padding: 18px; }
.login form { width: min(350px, 100%); background: #fff; border: 1px solid var(--line); padding: 32px; }
.login h1 { font-size: 20px; margin: 20px 0 5px; }
.login p { font-size: 11px; color: var(--muted); margin: 0 0 22px; }
.login label, .dialog-body label { display: flex; flex-direction: column; gap: 6px; font-size: 10px; font-weight: 700; color: #52657d; }
.login input, .dialog-body input, .dialog-body textarea { width: 100%; border: 1px solid var(--line); padding: 10px; border-radius: 5px; outline: 0; color: var(--ink); background: #fff; }
.login .primary { width: 100%; margin-top: 11px; }
.login small { display: block; color: var(--red); margin-top: 9px; }

dialog { border: 0; border-radius: 8px; padding: 0; width: min(610px, calc(100vw - 30px)); max-width: calc(100vw - 30px); max-height: calc(100dvh - 30px); box-shadow: 0 22px 60px #0b315a2c; color: var(--ink); }
dialog::backdrop { background: #10233f70; }
dialog header, dialog footer { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 17px 19px; border-bottom: 1px solid var(--line); }
dialog footer { justify-content: flex-end; border-top: 1px solid var(--line); border-bottom: 0; }
dialog h2 { font-size: 16px; margin: 0 0 3px; }
dialog p { font-size: 10px; color: var(--muted); margin: 0; }
.dialog-body { padding: 20px; }
.grid-form { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.grid-form .wide { grid-column: span 2; }
.confirm-box { display: grid; grid-template-columns: 22px 1fr; gap: 10px; align-items: start; border-left: 3px solid var(--amber); background: #fff8eb; padding: 13px; }
.confirm-box svg { width: 19px; color: var(--amber); }
.confirm-box p { font-size: 12px; color: var(--ink); line-height: 1.5; overflow-wrap: anywhere; }
.settings-dialog { width: min(520px, calc(100vw - 30px)); }
.settings-menu-dialog { width: min(430px, calc(100vw - 30px)); }
.settings-list { max-height: min(620px, calc(100dvh - 150px)); overflow: auto; padding: 6px 19px 12px; }
.settings-row {
  width: 100%;
  min-height: 62px;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 11px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  padding: 10px 2px;
  text-align: left;
}
.settings-row:hover { color: var(--blue); }
.settings-row > span:nth-child(2) { display: flex; min-width: 0; flex-direction: column; gap: 3px; }
.settings-row strong { font-size: 13px; }
.settings-row small { color: var(--muted); font-size: 10px; line-height: 1.35; overflow-wrap: anywhere; }
.settings-row > svg { width: 17px; color: var(--muted); }
.settings-row-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 6px; background: var(--blue-soft); color: var(--blue); }
.settings-row-icon svg { width: 17px; }
.settings-detail-body, .notification-settings { max-height: min(610px, calc(100dvh - 170px)); overflow: auto; }
.settings-section + .settings-section { margin-top: 22px; }
.settings-section h3 { margin: 0 0 7px; color: var(--muted); font-size: 9px; font-weight: 750; text-transform: uppercase; }
.setting-line { min-height: 49px; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 16px; border-bottom: 1px solid var(--line); }
.setting-line > span:first-child { display: flex; min-width: 0; flex-direction: column; gap: 3px; }
.setting-line strong { font-size: 12px; }
.setting-line small { color: var(--muted); font-size: 9px; line-height: 1.4; }
.setting-value { color: #52657d; font-size: 10px; font-weight: 700; text-align: right; }
.setting-value.good { color: #138a55; }
.setting-value.warn { color: var(--amber); }
.setting-line .secondary { min-height: 34px; padding-inline: 10px; }
.setting-line select { max-width: 155px; min-height: 34px; border: 1px solid var(--line); border-radius: 5px; background: #fff; color: var(--ink); padding: 6px 28px 6px 9px; font-size: 10px; }
.setting-note { margin: 12px 0 0 !important; line-height: 1.55; }
.text-size-options { width: 100%; margin-top: 12px; }
.text-size-options button { flex: 1; min-height: 40px; }
.text-size-preview { margin-top: 18px; padding: 16px; border: 1px solid var(--line); border-radius: 6px; background: var(--soft); }
.text-size-preview strong { display: block; font-size: 14px; margin-bottom: 5px; }
.text-size-preview p { font-size: 11px; line-height: 1.5; }
.notification-master { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.notification-master > div { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.notification-master strong { font-size: 13px; }
.notification-master span { color: var(--muted); font-size: 10px; line-height: 1.45; }
.notification-master .secondary { color: var(--red); }
#notification-priorities, #notification-categories { border: 0; border-bottom: 1px solid var(--line); padding: 18px 0 12px; margin: 0; }
#notification-priorities:disabled, #notification-categories:disabled, .quiet-hours.disabled { opacity: .45; }
#notification-priorities legend, #notification-categories legend { padding: 0 0 8px; color: var(--muted); font-size: 9px; font-weight: 750; text-transform: uppercase; }
#notification-priorities label, #notification-categories label { display: grid; grid-template-columns: 18px 1fr; gap: 10px; align-items: start; padding: 9px 0; cursor: pointer; }
#notification-priorities input, #notification-categories input { width: 17px; height: 17px; margin: 1px 0 0; accent-color: var(--blue); }
#notification-priorities label span, #notification-categories label span { display: flex; flex-direction: column; gap: 2px; }
#notification-priorities label strong, #notification-categories label strong { color: var(--ink); font-size: 12px; }
#notification-priorities label small, #notification-categories label small { color: var(--muted); font-size: 9px; font-weight: 500; }
.quiet-hours { padding-top: 17px; }
.settings-toggle { display: grid !important; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 16px; cursor: pointer; }
.settings-toggle > span { display: flex; flex-direction: column; gap: 3px; }
.settings-toggle strong { color: var(--ink); font-size: 12px; }
.settings-toggle small { color: var(--muted); font-size: 9px; font-weight: 500; line-height: 1.4; }
.settings-toggle input { width: 42px !important; height: 24px; accent-color: var(--blue); }
.quiet-times { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.quiet-times.disabled { opacity: .45; }
.danger-button { background: var(--blue); border-color: var(--blue); }
.toast { position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 15px); opacity: 0; background: var(--blue-dark); color: #fff; padding: 10px 14px; border-radius: 6px; font-size: 11px; pointer-events: none; transition: .2s; z-index: 50; white-space: nowrap; max-width: calc(100vw - 30px); overflow: hidden; text-overflow: ellipsis; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 1120px) {
  .shell { grid-template-columns: 190px minmax(480px, 1fr) 330px; }
  .workspace { padding: 25px 25px 70px; }
  .action-row { grid-template-columns: 7px minmax(170px, 1fr) minmax(150px, .9fr) auto; }
  .due { display: none; }
}

@media (max-width: 900px) {
  .shell { grid-template-columns: 190px 1fr; }
  .agent { position: fixed; right: 0; top: 0; width: min(380px, 100vw); transform: translateX(100%); transition: .2s; z-index: 20; box-shadow: 0 0 40px #0b315a22; }
  .agent.open { transform: translateX(0); }
  .mobile { display: grid; }
  .workspace { max-width: none; }
}

@media (max-width: 650px) {
  .shell { display: block; min-width: 0; }
  .sidebar {
    position: fixed;
    z-index: 15;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    height: calc(66px + env(safe-area-inset-bottom));
    border: 0;
    border-top: 1px solid var(--line);
    background: rgba(255, 255, 255, .96);
    padding: 5px 6px env(safe-area-inset-bottom);
    box-shadow: 0 -8px 24px #164b7c0d;
  }
  .brand, .sidebar footer { display: none; }
  .sidebar nav { height: 60px; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1px; }
  .nav { width: 100%; min-width: 0; height: 58px; display: flex; flex-direction: column; justify-content: center; gap: 3px; padding: 3px 1px; font-size: 9px; text-align: center; position: relative; border-radius: 6px; }
  .nav svg { width: 19px; height: 19px; flex-shrink: 0; }
  .nav b { position: absolute; top: 2px; left: calc(50% + 7px); right: auto; max-width: 30px; overflow: hidden; text-overflow: ellipsis; }
  .nav.active { background: var(--blue-soft); color: var(--blue-dark); }
  .workspace { width: 100%; min-width: 0; padding: max(18px, env(safe-area-inset-top)) 16px calc(88px + env(safe-area-inset-bottom)); overflow: hidden; }
  .topbar { align-items: flex-start; margin-bottom: 22px; }
  .topbar > div:first-child { min-width: 0; }
  .topbar h1 { font-size: 20px; line-height: 1.2; overflow-wrap: anywhere; }
  .top-actions { flex-shrink: 0; }
  .top-actions > span { display: none; }
  .desktop-notifications { display: none; }
  .banner { grid-template-columns: auto 1fr; padding: 12px; }
  .banner button { grid-column: 2; justify-self: start; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 30px; }
  .metrics > div { padding: 15px 12px 14px 0; margin-right: 12px; }
  .metrics > div:nth-child(2) { border-right: 0; margin-right: 0; padding-right: 0; }
  .metrics > div:last-child { grid-column: 1 / -1; border-top: 1px solid var(--line); padding: 14px 0; }
  .section-title { align-items: flex-start; }
  .section-title .text-button { align-self: center; font-size: 11px; }
  .action-row { grid-template-columns: 5px minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 15px 0; }
  .priority { height: 42px; }
  .action-detail { grid-column: 2; }
  .action-detail p { margin-bottom: 3px; }
  .due { display: block; grid-column: 2; }
  .row-actions { grid-column: 3; grid-row: 1 / 4; }
  .agenda-item { grid-template-columns: 44px minmax(0, 1fr) 36px; gap: 9px; }
  .agenda-item .agenda-icon { width: 32px; }
  .agenda-item > div { min-width: 0; }
  .agenda-item > div span { display: block; line-height: 1.4; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .mail-item { grid-template-columns: 8px minmax(0, 1fr); padding: 14px 0; }
  .mail-item time { grid-column: 2; grid-row: 2; }
  .mail-item p { grid-column: 2; }
  .calendar-legend { width: 100%; margin-top: 4px; }
  #calendario-view > .section-title, #attivita-view > .section-title { flex-direction: column; align-items: stretch; }
  .calendar { margin-left: 62px; }
  .calendar-day { padding-left: 21px; }
  .calendar-day > time { right: calc(100% + 14px); width: 48px; }
  .segmented { width: 100%; }
  .segmented button { flex: 1; min-height: 38px; }
  .table-wrap { margin-inline: -16px; padding-inline: 16px; }
  .grid-form { grid-template-columns: 1fr; }
  .grid-form .wide { grid-column: auto; }
  dialog { width: calc(100vw - 20px); max-width: calc(100vw - 20px); max-height: calc(100dvh - 20px); }
  dialog header, dialog footer { padding: 14px; }
  dialog header > div { min-width: 0; }
  dialog h2 { overflow-wrap: anywhere; }
  .dialog-body { padding: 16px 14px; }
  dialog footer { display: grid; grid-template-columns: 1fr 1fr; }
  dialog footer button { width: 100%; padding-inline: 8px; white-space: normal; line-height: 1.2; }
  .mail-dialog .dialog-body, .asset-dialog .dialog-body { max-height: calc(100dvh - 170px) !important; }
  .settings-dialog, .settings-menu-dialog { width: calc(100vw - 20px); }
  .settings-menu-dialog {
    inset: auto 0 calc(76px + env(safe-area-inset-bottom));
    margin: 0 auto;
    animation: settings-sheet-in .18s ease-out;
  }
  .settings-menu-dialog .dialog-body { padding: 5px 14px 12px; }
  #notification-dialog footer { grid-template-columns: minmax(0, 1fr) auto auto; }
  .notification-master { align-items: flex-start; }
  .notification-master button { flex-shrink: 0; }
  .toast { bottom: calc(78px + env(safe-area-inset-bottom)); }
}

@keyframes settings-sheet-in { from { opacity: 0; transform: translateY(12px); } }

@media (max-width: 380px) {
  .workspace { padding-inline: 12px; }
  .topbar h1 { font-size: 18px; }
  .section-title { gap: 9px; }
  .section-title .text-button { font-size: 0; gap: 0; padding: 0; width: 36px; min-height: 36px; }
  .section-title .text-button svg { width: 17px; }
  dialog footer { grid-template-columns: 1fr; }
}

html[data-text-size="comfortable"] .topbar small,
html[data-text-size="comfortable"] .section-title p,
html[data-text-size="comfortable"] .banner span { font-size: 13px; }
html[data-text-size="comfortable"] .section-title h2,
html[data-text-size="comfortable"] dialog h2 { font-size: 19px; }
html[data-text-size="comfortable"] .action-main strong,
html[data-text-size="comfortable"] .agenda-item strong,
html[data-text-size="comfortable"] .mail-item strong,
html[data-text-size="comfortable"] .calendar-day h3,
html[data-text-size="comfortable"] .settings-row strong { font-size: 15px; }
html[data-text-size="comfortable"] .action-main span,
html[data-text-size="comfortable"] .action-detail span,
html[data-text-size="comfortable"] .agenda-item span,
html[data-text-size="comfortable"] .mail-item span,
html[data-text-size="comfortable"] .mail-item p,
html[data-text-size="comfortable"] .calendar-day p,
html[data-text-size="comfortable"] .settings-row small,
html[data-text-size="comfortable"] .setting-value,
html[data-text-size="comfortable"] dialog p { font-size: 12px; }
html[data-text-size="comfortable"] .action-detail p,
html[data-text-size="comfortable"] .setting-line strong,
html[data-text-size="comfortable"] .message,
html[data-text-size="comfortable"] .command textarea { font-size: 14px; }
html[data-text-size="comfortable"] .due,
html[data-text-size="comfortable"] .mail-item time,
html[data-text-size="comfortable"] .calendar-day > time,
html[data-text-size="comfortable"] .entry-type,
html[data-text-size="comfortable"] .settings-section h3,
html[data-text-size="comfortable"] .setting-line small,
html[data-text-size="comfortable"] .setting-line select { font-size: 11px; }
html[data-text-size="comfortable"] .confirm-box p,
html[data-text-size="comfortable"] .mail-detail-body { font-size: 14px !important; }
html[data-text-size="comfortable"] .mail-detail-recipients { font-size: 12px !important; }
html[data-text-size="comfortable"] .primary,
html[data-text-size="comfortable"] .secondary,
html[data-text-size="comfortable"] .text-button,
html[data-text-size="comfortable"] .segmented button { font-size: 13px; }

html[data-text-size="large"] .topbar small,
html[data-text-size="large"] .section-title p,
html[data-text-size="large"] .banner span { font-size: 14px; }
html[data-text-size="large"] .section-title h2,
html[data-text-size="large"] dialog h2 { font-size: 21px; }
html[data-text-size="large"] .action-main strong,
html[data-text-size="large"] .agenda-item strong,
html[data-text-size="large"] .mail-item strong,
html[data-text-size="large"] .calendar-day h3,
html[data-text-size="large"] .settings-row strong { font-size: 17px; }
html[data-text-size="large"] .action-main span,
html[data-text-size="large"] .action-detail span,
html[data-text-size="large"] .agenda-item span,
html[data-text-size="large"] .mail-item span,
html[data-text-size="large"] .mail-item p,
html[data-text-size="large"] .calendar-day p,
html[data-text-size="large"] .settings-row small,
html[data-text-size="large"] .setting-value,
html[data-text-size="large"] dialog p { font-size: 14px; }
html[data-text-size="large"] .action-detail p,
html[data-text-size="large"] .setting-line strong,
html[data-text-size="large"] .message,
html[data-text-size="large"] .command textarea { font-size: 15px; }
html[data-text-size="large"] .due,
html[data-text-size="large"] .mail-item time,
html[data-text-size="large"] .calendar-day > time,
html[data-text-size="large"] .entry-type,
html[data-text-size="large"] .settings-section h3,
html[data-text-size="large"] .setting-line small,
html[data-text-size="large"] .setting-line select { font-size: 12px; }
html[data-text-size="large"] .confirm-box p,
html[data-text-size="large"] .mail-detail-body { font-size: 16px !important; }
html[data-text-size="large"] .mail-detail-recipients { font-size: 14px !important; }
html[data-text-size="large"] .primary,
html[data-text-size="large"] .secondary,
html[data-text-size="large"] .text-button,
html[data-text-size="large"] .segmented button { font-size: 14px; }

@media (max-width: 650px) {
  html[data-text-size="comfortable"] .nav { font-size: 11px; }
  html[data-text-size="large"] .nav { font-size: 12px; }
  html[data-text-size="comfortable"] .mail-item,
  html[data-text-size="large"] .mail-item { row-gap: 5px; }
  html[data-text-size="large"] .agenda-item > div span { white-space: normal; }
}

@media (max-width: 380px) {
  html[data-text-size="comfortable"] .section-title .text-button,
  html[data-text-size="large"] .section-title .text-button { font-size: 0; }
}
