/*
  This file is a part of myTinyTodo.
*/

/*
  Browsers support:
  Flexbox layout - https://caniuse.com/flexbox
  CSS masks from SVG images - https://caniuse.com/mdn-css_properties_mask-image_svg_masks
  CSS variables - https://caniuse.com/css-variables
*/


/* light colors */

:root {
  --color-bg: #ffffff;
  --color-text-default: #1a1a2e;
  --color-text-reduced: #374151;
  --color-text-reduced2: #6b7280;
  --color-text-reduced3: #9ca3af;
  --color-link: #4F46E5;
  --color-btn-reduced: #9ca3af;
  --color-btn-reduced-hover: #6b7280;
  --color-btn-default: #374151;
  --color-btn-hover: #f3f4f6;
  --color-submit: #f3f4f6;
  --color-submit-hover: #e5e7eb;
  --color-row-underlinig: #e5e7eb;
  --color-border-default: #e5e7eb;
  --color-border-focus: #4F46E5;
  --color-border-focus-shadow: rgba(79,70,229,0.15);
  --color-error: var(--color-text-reduced);
  --color-error-bg: #ef4444;
  --color-info: var(--color-text-reduced);
  --color-info-bg: #f59e0b;
  --color-input-bg: #fff;

  --color-toolbar: #f9fafb;
  --color-btn-toolbar-hover: #e5e7eb;
  --color-content-delimiter: #e5e7eb;
  --color-footer: #f9fafb;

  /* Tabs */
  --color-tab: #f9fafb;
  --color-tab-selected: #ffffff;
  --color-tab-hover: #f3f4f6;
  --color-tab-border: #e5e7eb;
  --color-tab-text: #374151;
  --color-btn-tab: #9ca3af;
  --color-btn-tab-hover: #fff;
  --color-btn-tab-hover-bg: #6b7280;

  /* Menu */
  --color-menu: #ffffff;
  --color-menu-border: #e5e7eb;
  --color-menu-hover: #4F46E5;
  --color-menu-text: #374151;
  --color-menu-text-hover: #fff;
  --color-menu-text-disabled: #d1d5db;
  --color-popup-shadow: 0 4px 16px rgba(0,0,0,0.08), 0 1px 4px rgba(0,0,0,0.04);

  /* Tasklist */
  --color-tasklist-row: var(--color-bg);
  --color-tasklist-row-border: var(--color-row-underlinig);
  --color-tasklist-row-inter-border: #f3f4f6;
  --color-tasklist-row-expanded-border: var(--color-tasklist-row-border);
  --color-tasklist-tag: var(--color-tab-text);
  --color-tasklist-note-link: #6b7280;
  --color-tasklist-link-hover: var(--color-link);
  --color-tasklisk-hover-shadow: rgba(0,0,0,0.06);
  --color-taglist-tag: var(--color-text-reduced);
  --color-taglist-tag-bg: #f3f4f6;
  --color-taglist-tag-hover: var(--color-taglist-tag);
  --color-taglist-tag-hover-bg: var(--color-taglist-tag-bg);
  --color-tasklist-listname: #6b7280;
  --color-tasklist-listname-bg: #f3f4f6;

  /* Priority */
  --color-priority-none: #e5e7eb;
  --color-priority-low: #3b82f6;
  --color-priority-high: #f97316;
  --color-priority-urgent: #ef4444;
  --color-priority-text: #fff;

  /* DueDates */
  --color-duedate-default: var(--color-tab-text);
  --color-duedate-soon: #10b981;
  --color-duedate-today: #ef4444;
  --color-duedate-past: #dc2626;


  /* Markdown */
  --color-md-border: #e5e7eb;
  --color-md-bg-highlighted: #f9fafb;
  --color-md-text-blockquote: #6b7280;

  /* Settings */
  --color-settings-row: #f9fafb;

  /* */
  --color-placeholder: #f3f4f6;
  --color-placeholder-border: #d1d5db;

  /* svg images */
  --svg-add: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIj8+CjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2aWV3Qm94PSIwIDAgMTYgMTYiPjxwb2x5bGluZSBwb2ludHM9IjE1IDQsIDE1IDksIDIgOSIgc3Ryb2tlLXdpZHRoPSIxLjUiIHN0cm9rZT0iIzAwMCIgZmlsbD0ibm9uZSIvPjxwb2x5bGluZSBwb2ludHM9IjYgNSwgMSA5LCA2IDEzIiBzdHJva2Utd2lkdGg9IjEuNSIgc3Ryb2tlPSIjMDAwIiBmaWxsPSJub25lIi8+PC9zdmc+Cg==');
  --svg-arr-left: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIj8+CjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2aWV3Qm94PSIwIDAgMTYgMTYiPjxwb2x5Z29uIHBvaW50cz0iMTAgMywgNCA4LCAxMCAxMyIgZmlsbD0iIzAwMCIvPjwvc3ZnPgo=');
  --svg-arr-right: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIj8+CjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2aWV3Qm94PSIwIDAgMTYgMTYiPjxwb2x5Z29uIHBvaW50cz0iNiAzLCAxMiA4LCA2IDEzIiBmaWxsPSIjMDAwIi8+PC9zdmc+Cg==');
  --svg-arrdown2: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIj8+CjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2aWV3Qm94PSIwIDAgOCA4Ij48cG9seWdvbiBwb2ludHM9IjAgMiwgOCAyLCA0IDYiIGZpbGw9ImJsYWNrIi8+PC9zdmc+Cg==');
  --svg-back: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIj8+CjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2aWV3Qm94PSIwIDAgMTQgMTQiPjxwb2x5bGluZSBwb2ludHM9IjkgMiwgNCA3LCA5IDEyIiBzdHJva2Utd2lkdGg9IjEuNSIgc3Ryb2tlPSIjMDAwIiBmaWxsPSJub25lIi8+PC9zdmc+Cg==');
  --svg-calendar: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIj8+CjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2aWV3Qm94PSIwIDAgMTYgMTYiPjxwYXRoIGZpbGw9IiNmZmYiIGQ9Ik0wLjUgMS41SDE1LjVWMTQuNUgwLjV6Ii8+PHBhdGggZmlsbD0iIzc4OGI5YyIgZD0iTTE1LDJ2MTJIMVYySDE1IE0xNiwxSDB2MTRoMTZWMUwxNiwxeiIvPjxwYXRoIGZpbGw9IiNmNzhmOGYiIGQ9Ik0wLjUgMS41SDE1LjVWNC41SDAuNXoiLz48cGF0aCBmaWxsPSIjYzc0MzQzIiBkPSJNMTUsMnYySDFWMkgxNSBNMTYsMUgwdjRoMTZWMUwxNiwxeiIvPjxwYXRoIGZpbGw9IiNjNWQ0ZGUiIGQ9Ik01IDdINlY4SDV6TTcgN0g4VjhIN3pNOSA3SDEwVjhIOXpNMTEgN0gxMlY4SDExek0zIDlINFYxMEgzek01IDlINlYxMEg1ek03IDlIOFYxMEg3ek05IDlIMTBWMTBIOXpNMTEgOUgxMlYxMEgxMXpNMyAxMUg0VjEySDN6TTUgMTFINlYxMkg1ek03IDExSDhWMTJIN3pNOSAxMUgxMFYxMkg5eiIvPjwvc3ZnPgo=');
  --svg-checkmark: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIj8+CjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2aWV3Qm94PSIwIDAgMTYgMTYiPjxwb2x5bGluZSBwb2ludHM9IjQgOCwgNyAxMiwgMTMgNSIgZmlsbD0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2U9IiMwMDAiLz48L3N2Zz4K');
  --svg-closetag: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIj8+CjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2aWV3Qm94PSIwIDAgMTYgMTYiPjxnIHN0cm9rZS13aWR0aD0iMS41IiBmaWxsPSJub25lIj48cGF0aCBkPSJNMTIuMCAxMi4wbC04LTgiIHN0cm9rZT0iIzAwMCIvPjxwYXRoIGQ9Ik00LjAgMTIuMGwrOC04IiBzdHJva2U9IiMwMDAiLz48L2c+PC9zdmc+Cg==');
  --svg-newtask-ext: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIj8+CjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2aWV3Qm94PSIwIDAgMTYgMTYiPjxnIHN0cm9rZT0iIzAwMCIgZmlsbD0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxLjAiPjxwb2x5bGluZSBwb2ludHM9IjEwIDAuNSwgMC41IDAuNSwgMC41IDE1LjUsIDEzLjUgMTUuNSwgMTMuNSA3LjUiIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz48cG9seWxpbmUgcG9pbnRzPSI3IDcsIDYgMTAsIDkgOSwgMTUgMywgMTMgMSwgNyA3LCA2IDEwIi8+PGxpbmUgeDE9IjciIHkxPSI3IiB4Mj0iOSIgeTI9IjkiLz48L2c+PC9zdmc+Cg==');
  --svg-note-toggle: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIj8+CjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2aWV3Qm94PSIwIDAgMTQgMTQiPjxwb2x5bGluZSBwb2ludHM9IjUgMiwgMTAgNywgNSAxMiIgc3Ryb2tlLXdpZHRoPSIxLjUiIHN0cm9rZT0iIzAwMCIgZmlsbD0ibm9uZSIvPjwvc3ZnPgo=');
  --svg-plus: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIj8+CjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2aWV3Qm94PSIwIDAgMTYgMTYiPjxsaW5lIHgxPSIyIiB5MT0iOCIgeDI9IjE0IiB5Mj0iOCIgc3Ryb2tlLXdpZHRoPSIxLjUiIHN0cm9rZT0iIzAwMCIvPjxsaW5lIHgxPSI4IiB5MT0iMiIgeDI9IjgiIHkyPSIxNCIgc3Ryb2tlLXdpZHRoPSIxLjUiIHN0cm9rZT0iIzAwMCIvPjwvc3ZnPgo=');
  --svg-rss: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA4IDgiPjx0aXRsZT5SU1MgZmVlZCBpY29uPC90aXRsZT48c3R5bGUgdHlwZT0idGV4dC9jc3MiPgogICAgLmJ1dHRvbiB7c3Ryb2tlOiBub25lOyBmaWxsOiBvcmFuZ2U7fQogICAgLnN5bWJvbCB7c3Ryb2tlOiBub25lOyBmaWxsOiB3aGl0ZTt9CiAgPC9zdHlsZT48cmVjdCBjbGFzcz0iYnV0dG9uIiB3aWR0aD0iOCIgaGVpZ2h0PSI4IiByeD0iMS41Ii8+PGNpcmNsZSBjbGFzcz0ic3ltYm9sIiBjeD0iMiIgY3k9IjYiIHI9IjEiLz48cGF0aCBjbGFzcz0ic3ltYm9sIiBkPSJtIDEsNCBhIDMsMyAwIDAgMSAzLDMgaCAxIGEgNCw0IDAgMCAwIC00LC00IHoiLz48cGF0aCBjbGFzcz0ic3ltYm9sIiBkPSJtIDEsMiBhIDUsNSAwIDAgMSA1LDUgaCAxIGEgNiw2IDAgMCAwIC02LC02IHoiLz48L3N2Zz4K');
  --svg-rss-disabled: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA4IDgiPjx0aXRsZT5SU1MgZmVlZCBpY29uPC90aXRsZT48c3R5bGUgdHlwZT0idGV4dC9jc3MiPgogICAgLmJ1dHRvbiB7c3Ryb2tlOiBub25lOyBmaWxsOiAjYmJiO30KICAgIC5zeW1ib2wge3N0cm9rZTogbm9uZTsgZmlsbDogd2hpdGU7fQogIDwvc3R5bGU+PHJlY3QgY2xhc3M9ImJ1dHRvbiIgd2lkdGg9IjgiIGhlaWdodD0iOCIgcng9IjEuNSIvPjxjaXJjbGUgY2xhc3M9InN5bWJvbCIgY3g9IjIiIGN5PSI2IiByPSIxIi8+PHBhdGggY2xhc3M9InN5bWJvbCIgZD0ibSAxLDQgYSAzLDMgMCAwIDEgMywzIGggMSBhIDQsNCAwIDAgMCAtNCwtNCB6Ii8+PHBhdGggY2xhc3M9InN5bWJvbCIgZD0ibSAxLDIgYSA1LDUgMCAwIDEgNSw1IGggMSBhIDYsNiAwIDAgMCAtNiwtNiB6Ii8+PC9zdmc+Cg==');
  --svg-search: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIj8+CjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2aWV3Qm94PSIwIDAgMTYgMTYiPjxnIHN0cm9rZS13aWR0aD0iMS41IiBzdHJva2U9IiMwMDAiIGZpbGw9Im5vbmUiPjxwYXRoIGQ9Ik0xNCAxNGwtNC00Ii8+PGNpcmNsZSBjeD0iNyIgY3k9IjciIHI9IjQuNSIvPjwvZz48L3N2Zz4K');
  --svg-search-cancel: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIj8+CjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2aWV3Qm94PSIwIDAgMTYgMTYiPjxwYXRoIGQ9Im04IDFhNyA3IDAgMCAwLTcgNyA3IDcgMCAwIDAgNyA3IDcgNyAwIDAgMCA3LTcgNyA3IDAgMCAwLTctN3ptLTIuNDY4OCAzLjQ2ODggMi40Njg4IDIuNDY4OCAyLjQ2ODgtMi40Njg4IDEuMDYyNSAxLjA2MjUtMi40Njg4IDIuNDY4OCAyLjQ2ODggMi40Njg4LTEuMDYyNSAxLjA2MjUtMi40Njg4LTIuNDY4OC0yLjQ2ODggMi40Njg4LTEuMDYyNS0xLjA2MjUgMi40Njg4LTIuNDY4OC0yLjQ2ODgtMi40Njg4IDEuMDYyNS0xLjA2MjV6IiBmaWxsPSIjMDAwIi8+PC9zdmc+Cg==');
  --svg-select: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIj8+CjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2aWV3Qm94PSIwIDAgMTQgMTQiPjxwb2x5bGluZSBwb2ludHM9IjIgNiwgNyAxMSwgMTIgNiIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2U9IiM0NDQiIGZpbGw9Im5vbmUiLz48L3N2Zz4K');
  --svg-select-dark: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIj8+CjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2aWV3Qm94PSIwIDAgMTQgMTQiPjxwb2x5bGluZSBwb2ludHM9IjIgNiwgNyAxMSwgMTIgNiIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2U9IiNhYWEiIGZpbGw9Im5vbmUiLz48L3N2Zz4K');
  --svg-selectlist: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIj8+CjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2aWV3Qm94PSIwIDAgMTYgMTYiPjxjaXJjbGUgY3g9IjMiIGN5PSI4IiByPSIxLjUiIGZpbGw9IiMzMzMiLz48Y2lyY2xlIGN4PSI4IiBjeT0iOCIgcj0iMS41IiBmaWxsPSIjMzMzIi8+PGNpcmNsZSBjeD0iMTMiIGN5PSI4IiByPSIxLjUiIGZpbGw9IiMzMzMiLz48L3N2Zz4K');
  --svg-selectlist2: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIj8+CjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2aWV3Qm94PSIwIDAgMTYgMTYiPjxnIGZpbGw9Im5vbmUiIHN0cm9rZS13aWR0aD0iMS41IiBzdHJva2U9IiMwMDAiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCI+PGxpbmUgeDE9IjIiIHkxPSIzIiB4Mj0iMTQiIHkyPSIzIi8+PGxpbmUgeDE9IjIiIHkxPSI4IiB4Mj0iMTQiIHkyPSI4Ii8+PGxpbmUgeDE9IjQiIHkxPSIxMyIgeDI9IjE0IiB5Mj0iMTMiLz48L2c+PC9zdmc+Cg==');
  --svg-task-menu: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIj8+CjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2aWV3Qm94PSIwIDAgMTQgMTQiPjxwb2x5bGluZSBwb2ludHM9IjIgNiwgNyAxMSwgMTIgNiIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2U9IiMwMDAiIGZpbGw9Im5vbmUiLz48L3N2Zz4K');
  --svg-task-menu2: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIj8+CjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2aWV3Qm94PSIwIDAgMTQgMTQiPjxnIGZpbGw9IiMwMDAiPjxjaXJjbGUgY3g9IjciIGN5PSIyIiByPSIxLjUiLz48Y2lyY2xlIGN4PSI3IiBjeT0iNyIgcj0iMS41Ii8+PGNpcmNsZSBjeD0iNyIgY3k9IjEyIiByPSIxLjUiLz48L2c+PC9zdmc+Cg==');
}

/*	default style	*/

html {
  height:100%;
  font-size:15px;
}
body {
  margin: 0px;
  padding: 0px;
  width: 100%;
  height: 100%;
  background-color: #f9fafb;
  color: var(--color-text-default);
  display:flex;
  flex-direction:column;
  align-items:center;
  overflow-y: scroll;
  line-height: 1.6;
}
body, td, th, input, textarea, select, button {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  font-size: 1rem;
}
#mtt {
  flex: 1 0 auto;
  width:100%;
  max-width:1600px;
  padding:16px 24px;
  margin-bottom: 1rem;
  box-sizing: border-box;
}

form { display: inline; }
.topblock h2 {
  margin:0;
  font-size:1.5rem;
  padding-left: 30px;
  padding-right: 10px;
  background: url(images/logo.gif) no-repeat top left;
  background-size: 24px 24px;
  font-weight: 600;
  letter-spacing: -0.02em;
}
#mtt.ajax-loading .topblock h2 {
  background-image: url(images/logo-loading.gif);
}

/* preload images */
body::after {
  position:absolute; width:0; height:0; overflow:hidden; z-index:-1;
  content:url(images/logo-loading.gif);
}

h3.page-title {
  margin:0;
  border-bottom:2px solid var(--color-content-delimiter);
  margin-bottom:1rem;
  padding:0.8rem 0;
  font-size:1.1rem;
  font-weight: 600;
}
a { color: var(--color-link); cursor:pointer; text-decoration:none; transition: color 0.15s ease; }
a:hover { text-decoration:underline; }

.topblock {
  display: flex;
  align-items: center;
  margin-bottom: 1rem;
  background: var(--color-bg, #fff);
  border-radius: 10px;
  padding: 8px 16px;
  border: 1px solid var(--color-border-default, #e5e7eb);
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}
#footer {
  flex-shrink:0;
  width:100%;
  max-width:1600px;
}
#footer_content {
  background-color: var(--color-footer);
  border-top: 1px solid var(--color-content-delimiter);
  padding:0.8rem 1rem;
  font-size:0.9rem;
  display:flex;
  justify-content:space-between;
}
#footer_content span:last-child { text-align:center; }
#footer_content a {
  color: var(--color-text-default);
}
#footer_content a.powered-by-link { font-weight:600; }

.topblock-title {
  display:flex;
  align-items:center;
  min-width: 0;
}
.topblock-bar {
  flex-grow:1;
  display:flex;
  justify-content:flex-start;
  padding-bottom: 0;
}
.bar-menu {
  flex-grow:1;
  display:flex;
  justify-content:flex-end;
  text-align:right;
  white-space: nowrap;
}
.bar-menu > * {
  margin-left: 10px;
}


#mtt.no-need-auth .mtt-need-auth-enabled { display:none; }

.form-input {
  padding: 8px 12px;
  border: 1px solid var(--color-border-default);
  background-color: var(--color-input-bg);
  border-radius: 6px;
  transition: box-shadow .15s ease, border-color .15s ease;
  font-size: 0.93rem;
  line-height: 1.5;
}
select.form-input {
  appearance: none;
  -webkit-appearance: none; -moz-appearance: none;
  background: var(--color-input-bg) var(--svg-select) no-repeat top 4px right 5px;
  background-size: 1rem 1rem;
  padding-right: calc(1rem + 10px);
}
.form-input:focus {
  outline: none;
  border-color: var(--color-border-focus);
  box-shadow: 0 0 0 3px var(--color-border-focus-shadow);
}
.form-bottom-buttons {
  display: flex;
  justify-content: center;
  padding: 1.2rem 0;
}
.form-bottom-buttons > * {
  min-width: 5rem;
  padding: 8px 16px;
  margin: 0 6px;
  background-color: var(--color-submit);
  border: 1px solid var(--color-border-default);
  border-radius: 6px;
  font-size: 0.93rem;
  cursor: pointer;
  transition: background-color 0.15s ease;
}
.form-bottom-buttons > *:hover {
  background-color: var(--color-submit-hover);
}


#page_login {
  max-width: 280px;
  margin:0 auto;
  margin-top: 20px;
}
#authform {
  background-color: var(--color-menu);
  border: 1px solid var(--color-menu-border);
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
#authform .auth-content {
  padding: 1.8rem;
}
#authform div { padding:4px 0px; }
#authform .form-bottom-buttons {
  border-top: 1px solid var(--color-border-default);
  padding: 1rem 0;
}

#authform div.h { font-weight:600; }
#authform input[type=password], #authform input[type=text] { width: 100%; box-sizing: border-box; }

#msg .msg-text {  font-weight:600; cursor:pointer; padding:2px 6px; border-radius: 4px; }
#msg .msg-details {
  display:none;
  padding:4px 8px;
  background-color: var(--color-bg);
  max-width:800px;
  position:absolute;
  z-index:2;
  white-space: pre-line;
}
#msg.mtt-error .msg-text { background-color: var(--color-error-bg); color: #fff; }
#msg.mtt-error .msg-details { border:1px solid var(--color-error-bg);  }
#msg.mtt-error .msg-text, #msg.mtt-error .msg-details { color: var(--color-error); }
#msg.mtt-info .msg-text { background-color: var(--color-info-bg); color: #fff; }
#msg.mtt-info .msg-details { border:1px solid var(--color-info-bg); }
#msg.mtt-info .msg-text, #msg.mtt-info .msg-details { color: var(--color-info); }

#lists { font-size:0.95rem; display:flex; align-items:flex-start; justify-content:flex-end; }
#mtt.readonly.no-lists #lists > * { visibility: hidden; }
.tabs-n-button { flex-grow:1; display:flex; align-items:flex-start; }
.tab-height-wrapper { box-sizing:border-box; height:2.4rem; display:flex; align-items:center; }
.mtt-tabs { list-style:none; padding:0; margin:0; display:flex; justify-content:flex-start; flex-wrap:wrap; }
.mtt-tab {
  margin:1px 3px 0 0;
  background-color: var(--color-tab);
  border:1px solid var(--color-tab-border);
  border-bottom:none;
  border-top-right-radius:8px;
  transition:background-color 0.15s ease;
  max-width:230px;
}
.mtt-tab a {
  margin:0; text-decoration:none; white-space:nowrap;
  color: var(--color-tab-text);
  display:inline-block; outline:none;
  box-sizing:border-box;
  height:2.4rem;
  padding:1px 8px 0 8px;
  display:flex;
  align-items:center;
}
.mtt-tab a:active {
  outline:0;
  text-decoration:none;
}
.mtt-tab .title-block {
  display: flex;
  align-items: baseline;
  min-width: 75px;
}
.mtt-tab .title {
  display:inline-block;
  text-align:center;
  cursor:pointer;
  padding:0;
  overflow:hidden;
  text-overflow: ellipsis;
  margin-left:6px;
  margin-right:6px;
  flex-grow:1;
}
.mtt-tab .list-action { display:none; }
.mtt-tab .mtt-img-button:hover,
.mtt-tab .mtt-img-button.mtt-menu-button-active {
  background-color:var(--color-btn-tab-hover-bg);
}
.mtt-tab .mtt-img-button > span {
  width: 8px; height: 8px;
  mask: url(images/arrdown2.svg) no-repeat; -webkit-mask: url(images/arrdown2.svg) no-repeat;
  background-color: var(--color-btn-tab);
  transition: background-color 0.15s ease;
}
.mtt-tab .mtt-img-button:hover > span,
.mtt-tab .mtt-img-button.mtt-menu-button-active > span {
  background-color: var(--color-btn-tab-hover);
}
.mtt-tab.mtt-tab-selected .list-action { display:block; }
.mtt-tab.mtt-tab-selected { border-color: var(--color-tab-selected); background-color: var(--color-tab-selected); box-shadow: 0 1px 2px rgba(0,0,0,0.04); }
.mtt-tab:not(.mtt-tab-selected):hover { background-color: var(--color-tab-hover); }
.mtt-tab.mtt-tab-selected a { color: var(--color-text-default); font-weight: 500; }

.mtt-tab-hidden { display:none; }
.mtt-tab-sort-placeholder {
  background-color: var(--color-placeholder);
  border-color: var(--color-placeholder-border);
}
.mtt-tab .counter {
  display: inline-block;
  min-width: 1.2rem;
  height: 1rem;
  border-radius: 1rem;
  font-size: 0.75rem;
  text-align: center;
  background-color: #6b7280;
  color: white;
  padding: 0 4px;
}
.mtt-tab .counter.hidden {
  display: none;
}

#tabs_buttons {
  padding-left:2px; padding-right:2px;
  border-top:1px solid transparent;
  margin-top:1px;
}

.mtt-tabs-new-button { display:inline-block; margin-top:1px; border:1px solid var(--color-tab-border); border-bottom:none; border-top-right-radius: 8px;
  background-color: var(--color-tab);
  padding-left:3px; padding-right:3px;
}
.mtt-tabs-new-button span {
  display:block;
  width:16px; height:16px;
  mask: url(images/plus.svg) no-repeat; -webkit-mask: url(images/plus.svg) no-repeat;
  background-color: var(--color-tab-text);
}
.mtt-tabs-new-button:hover { cursor:pointer; background-color: var(--color-tab-hover); }
#mtt.readonly .mtt-tabs-new-button { display:none; }

.mtt-tabs-select-button > span {
  mask: url(images/selectlist2.svg) no-repeat; -webkit-mask: url(images/selectlist2.svg) no-repeat;
  background-color: var(--color-tab-text);
}

.mtt-img-button {
  padding: 6px;
  display:block;
  border-radius:6px;
  transition:background-color 0.15s ease;
  cursor:pointer;
}
.mtt-img-button:hover,
.mtt-img-button.mtt-menu-button-active {
  background-color: var(--color-btn-hover);
}
.mtt-img-button span { display:block; width:16px; height:16px; }

#mtt.no-lists         #toolbar > * { visibility:hidden; }
#mtt.no-list-selected #toolbar > * { visibility:hidden; }
#mtt.readonly.no-lists #toolbar { visibility: hidden; }
#toolbar  {
  padding:10px 12px;
  border-bottom:1px solid var(--color-row-underlinig);
  background: var(--color-toolbar);
  border-radius: 8px 8px 0 0;
}
#toolbar .mtt-img-button:hover {
  background-color: var(--color-btn-toolbar-hover);
}

.arrdown, .arrdown2  {
  display: inline-block;
  height: 9px; width:9px;
  mask: url(images/arrdown2.svg) no-repeat; -webkit-mask: url(images/arrdown2.svg) no-repeat;
  background-color: var(--color-btn-default);
}
.arrdown2 {
  height:7px; width:7px;
}

.newtask-n-search-container {
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

/* Quick Task Add */
.taskbox-c { flex-grow:1; display:flex; align-items:center; }
.mtt-taskbox { position:relative; padding-left:22px; flex-grow:1; }
#task {
  color: var(--color-text-reduced);
  background: var(--color-bg);
  height:1.5rem; padding:6px 10px; padding-right:20px; border:1px solid var(--color-border-default); border-radius:6px; width:100%; margin-left:-24px;
  font-size: 0.93rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
#mtt.show-all-tasks .taskbox-c,
#mtt.readonly .taskbox-c {
  visibility: hidden;
}

.mtt-taskbox-icon {
  width:16px; height:16px;
  position:absolute;
  top:50%;
  right:2px;
  margin-top:-8px;
  cursor:pointer;
  mask: url(images/add.svg) no-repeat; -webkit-mask: url(images/add.svg) no-repeat;
  background-color: var(--color-btn-reduced);
  transition: background-color 0.15s ease;
}
.mtt-taskbox-icon:hover {
  background-color: var(--color-btn-reduced-hover);
}
#newtask_adv { margin-left:0.5rem; }
#newtask_adv span {
  mask: url(images/newtask-ext.svg) no-repeat; -webkit-mask: url(images/newtask-ext.svg) no-repeat;
  background-color: var(--color-btn-reduced);
}


/* Live Search */
#search {
 color: var(--color-text-reduced);
 background: var(--color-bg);
 height:1.5rem; padding:6px 24px; width:100%; margin-left:-46px;
 border:1px solid var(--color-border-default); border-radius:20px;
 font-size: 0.93rem;
 transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
#search_close { display:none; }

.mtt-searchbox { position:relative; padding-left:46px; }
.mtt-searchbox-icon { width:16px; height:16px; position:absolute; top:50%; margin-top:-8px; }
.mtt-searchbox-icon.mtt-icon-search {
  left:4px;
  mask: url(images/search.svg) no-repeat; -webkit-mask: url(images/search.svg) no-repeat;
  background-color: var(--color-btn-reduced);
}
.mtt-searchbox-icon.mtt-icon-cancelsearch {
  right:4px;
  cursor:pointer;
  mask: url(images/search-cancel.svg) no-repeat; -webkit-mask: url(images/search-cancel.svg) no-repeat;
  background-color: var(--color-btn-reduced);
  transition: background-color 0.15s ease;
}
.mtt-searchbox-icon.mtt-icon-cancelsearch:hover {
  background-color: var(--color-btn-reduced-hover);
}

#searchbar { font-size:1rem; font-weight:normal; display:none;  margin-top:0.5rem; }
#searchbarkeyword { font-weight:600; }

/* */
#page_tasks h3 { display:flex; align-items:baseline; }
#mtt.no-lists         #page_tasks h3 { visibility:hidden; }
#mtt.no-list-selected #page_tasks h3 { visibility:hidden; }
.mtt-notes-showhide { font-size:1rem; font-weight:normal; margin-left:5px; margin-right:5px; }
.mtt-notes-showhide a { text-decoration:none; border-bottom:1px dotted; }


/* Tag Toolbar */
#mtt-tag-toolbar { font-size:1.0rem; font-weight:normal; margin-top:0.5rem; line-height:1.5rem; display:flex; }
.tag-toolbar-content { flex:auto; margin-bottom:-3px; }
.tag-toolbar-close { flex-shrink:0; }
.tag-toolbar-header { font-weight:normal; }
.tag-filter {
  margin-left:3px;
  margin-right:3px;
  display:inline-flex;
  align-items:center;
  border:1px solid var(--color-border-default);
  border-radius:2rem;
  background-color: var(--color-bg);
  padding:2px 10px;
  margin-bottom:3px;
  cursor:pointer;
  transition: border-color 0.15s ease;
}
.tag-filter:hover { border-color: var(--color-link); }
.tag-filter-exclude { text-decoration:line-through; }
.mtt-filter-header { font-weight:600; margin-right:.33rem; }
.tag-filter-btn {
  margin-left:3px;
  display:inline-block;
  width:1em; height:1em;
  mask: var(--svg-closetag) no-repeat; -webkit-mask: var(--svg-closetag) no-repeat;
  background-color: var(--color-btn-reduced);
  transition: background-color 0.15s ease;
}
.tag-filter:hover .tag-filter-btn {
  background-color: var(--color-btn-reduced-hover);
}
#mtt-tag-toolbar-close span {
  mask: var(--svg-closetag) no-repeat; -webkit-mask: var(--svg-closetag) no-repeat;
  background-color: var(--color-btn-reduced);
}

/* Category Badge */
.task-category-badge {
  display:inline-block;
  font-size:0.68rem;
  font-weight:600;
  padding:0 6px;
  margin-left:4px;
  border-radius:3px;
  color:#fff;
  line-height:1.4;
  cursor:pointer;
  vertical-align:middle;
  user-select:none;
}

/* Attachment Icon */
.task-attachment-icon {
  display:inline-block;
  font-size:0.75rem;
  margin-left:4px;
  vertical-align:middle;
  line-height:1.4;
  opacity:0.6;
}

/* Category Filter Bar */
#category-filter-bar {
  display: none;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  padding: 2px 0 4px 12px;
  border-bottom: 1px solid var(--color-border-default);
  background: var(--color-toolbar-bg, transparent);
  font-size: 0.78rem;
}
.category-filter-label {
  font-weight: 600;
  color: var(--color-text-reduced2, inherit);
  white-space: nowrap;
}
#category-filter-select {
  font-size: 0.78rem;
  padding: 1px 4px;
  max-width: 200px;
}
.category-filter-chip {
  display:inline-flex;
  align-items:center;
  border:1px solid var(--color-border-default);
  border-radius:2rem;
  background-color: var(--color-bg);
  padding:0 8px;
  font-size:0.78rem;
}
.category-filter-cancel {
  font-size: 1.1rem;
  font-weight: bold;
  color: var(--color-text-reduced2);
  margin-left: 2px;
}
.category-filter-cancel:hover {
  color: var(--color-link);
}
.category-manage-link {
  margin-left:auto;
  text-decoration:none;
  font-size:0.9rem;
  color:var(--color-text-reduced2, #666);
  padding:0 4px;
}
.category-manage-link:hover {
  color:var(--color-link);
}

/* Sidebar */
.main-layout {
  display: flex;
  gap: 12px;
}
#sidebar {
  width: 220px;
  flex-shrink: 0;
  font-size: 0.85rem;
  border-right: 1px solid var(--color-border-default, #e2e8f0);
  margin-right: 8px;
  background: #1e293b;
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 16px 12px 16px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.15);
}
.sidebar-brand-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.sidebar-brand-icon svg {
  width: 18px;
  height: 18px;
  stroke: #fff;
}
.sidebar-brand-text {
  font-size: 1rem;
  font-weight: 700;
  color: #f1f5f9;
  letter-spacing: -0.3px;
}
.sidebar-brand-text span {
  color: var(--color-link, #6366f1);
}
.sidebar-section {
  padding: 8px 8px 4px 8px;
}
.sidebar-heading {
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.6rem;
  color: #64748b;
  padding: 8px 10px 6px 10px;
  letter-spacing: 1.2px;
}
.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  color: #cbd5e1;
  text-decoration: none;
  border-radius: 8px;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
  margin-bottom: 2px;
  font-weight: 500;
  position: relative;
}
.sidebar-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  stroke: #64748b;
  transition: stroke 0.2s ease;
}
.sidebar-item:hover {
  background: rgba(99, 102, 241, 0.12);
  text-decoration: none;
}
.sidebar-item:hover .sidebar-icon {
  stroke: #818cf8;
}
.sidebar-item.active {
  background: rgba(99, 102, 241, 0.18);
  font-weight: 600;
  color: #a5b4fc;
}
.sidebar-item.active .sidebar-icon {
  stroke: #a5b4fc;
}
.sidebar-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--color-border-default, #e2e8f0);
  color: var(--color-text-reduced2, #94a3b8);
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0 6px;
  border-radius: 10px;
  min-width: 18px;
  height: 18px;
  text-align: center;
  line-height: 1;
  margin-left: auto;
  float: right;
}
.sidebar-item.active .sidebar-count {
  background: var(--color-link, #6366f1);
  color: #fff;
}
.sidebar-cat-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
}
.sidebar-cat-color {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
/* Toast notifications */
#toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 400px;
}
.toast {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  font-size: 0.9rem;
  animation: toast-in 0.3s ease-out;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
.toast-info { background: var(--color-bg, #fff); border: 1px solid var(--color-border-default, #ddd); color: var(--color-text-default, #333); }
.toast-success { background: #d4edda; border: 1px solid #c3e6cb; color: #155724; }
.toast-error { background: var(--color-bg, #fff); border: 1px solid var(--color-border-default, #ddd); color: var(--color-text-default, #333); border-left: 4px solid #e5484d; }
.toast-msg { flex: 1; }
.toast-undo, .toast-dismiss {
  background: none;
  border: none;
  cursor: pointer;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.85rem;
}
.toast-undo { color: var(--color-link, #4a90d9); }
.toast-undo:hover { text-decoration: underline; }
.toast-dismiss { color: var(--color-text-reduced2, #888); font-size: 1.1rem; }
.toast-dismiss:hover { color: var(--color-text, #333); }
.ai-nudge-task { font-weight: 700; font-size: 0.92rem; display: inline-block; margin-bottom: 2px; }
.toast-ai-nudge,
.toast-ai-nudge.toast-error,
.toast-ai-nudge.toast-info {
    background: #87ceeb;
    border: 1px solid #6cb4d8;
    color: #000;
}
.toast-ai-nudge .toast-msg { color: #000; line-height: 1.45; }
.toast-ai-nudge .ai-nudge-task { color: #fff; }
.toast-ai-nudge .toast-undo { color: #000; }
.toast-ai-nudge .toast-dismiss { color: #1f2937; }

/* Dashboard - Modern Enhanced */
#page_tasks,
#page_dashboard,
#page_ajax,
#page_week {
  flex: 1;
  min-width: 0;
}
#page_dashboard h3.page-title {
  margin-bottom: 16px;
}
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}
.dash-card {
  background: #1e293b;
  border: 1px solid rgba(148, 163, 184, 0.15);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
  transition: box-shadow 0.2s, transform 0.15s, border-color 0.2s;
  position: relative;
  overflow: hidden;
}
.dash-card::before {
  content: '';
  position: absolute;
  top: -30%;
  right: -20%;
  width: 100px;
  height: 100px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.1) 0%, transparent 70%);
  pointer-events: none;
}
.dash-card:hover {
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
  transform: translateY(-2px);
  border-color: rgba(99, 102, 241, 0.25);
}
.dash-card-num {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.2;
  background: linear-gradient(135deg, #818cf8, #22d3ee);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.dash-card-label {
  font-size: 0.78rem;
  color: #64748b;
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.dash-card-total .dash-card-num { color: #818cf8; }
.dash-card-active .dash-card-num { color: #34d399; }
.dash-card-completed .dash-card-num { color: #64748b; }
.dash-card-overdue .dash-card-num { color: #f87171; }
.dash-card-today .dash-card-num { color: #fb923c; }
.dash-card-week .dash-card-num { color: #34d399; }
.dash-card-highprio .dash-card-num { color: #f87171; }
.dash-card-trash .dash-card-num { color: #64748b; }
.dash-card-archive .dash-card-num { color: #64748b; }
.dash-card-created-today .dash-card-num { color: #60a5fa; }
.dash-card-completed-today .dash-card-num { color: #34d399; }

.dash-section {
  margin-bottom: 24px;
  background: var(--color-bg, #fff);
  border: 1px solid var(--color-border-default, #ddd);
  border-radius: 10px;
  padding: 16px;
}
.dash-section h4 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 8px 0;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--color-content-delimiter, #e5e7eb);
}
.dash-list { padding: 0; }
.dash-bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  font-size: 0.85rem;
}
.dash-cat-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dash-bar-label {
  width: 100px;
  flex-shrink: 0;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--color-text-default, #333);
}
.dash-bar {
  flex: 1;
  height: 12px;
  background: var(--color-tab, #eee);
  border-radius: 6px;
  overflow: hidden;
}
.dash-bar-fill {
  display: block;
  height: 100%;
  border-radius: 6px;
  background: var(--color-link, #4a90d9);
  transition: width 0.5s ease;
}
.dash-prio--1 { background: var(--color-text-reduced3, #9ca3af); }
.dash-prio-0 { background: var(--color-link, #4a90d9); }
.dash-prio-1 { background: var(--color-priority-high, #f97316); }
.dash-prio-2 { background: var(--color-priority-urgent, #ef4444); }
.dash-bar-num {
  width: 40px;
  text-align: right;
  font-weight: 600;
  color: var(--color-text-default, #333);
}

/* Trash / Archive views */
.task-trash-row .task-block,
.task-archive-row .task-block {
  opacity: 0.75;
}
.task-trash-row .task-actions,
.task-archive-row .task-actions {
  flex: 0 0 auto;
  display: flex;
  gap: 2px;
  align-items: center;
}
.btn-restore, .btn-unarchive {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border: 1px solid var(--color-border, #d1d5db);
  border-radius: 4px;
  background: var(--color-toolbar, #f9fafb);
  color: var(--color-text-default);
  cursor: pointer;
  font-size: 0.85rem;
  white-space: nowrap;
}
.btn-restore span, .btn-unarchive span {
  display: inline-block;
  width: 14px;
  height: 14px;
  background: var(--color-link, #4F46E5);
  -webkit-mask: var(--svg-checkmark) center/contain no-repeat;
  mask: var(--svg-checkmark) center/contain no-repeat;
  flex-shrink: 0;
}
.btn-restore:hover, .btn-unarchive:hover {
  background: var(--color-hover, #e5e7eb);
}
.btn-delete-perm {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border: 1px solid var(--color-border, #d1d5db);
  border-radius: 4px;
  background: var(--color-toolbar, #f9fafb);
  color: var(--color-duedate-past, #dc2626);
  cursor: pointer;
  font-size: 0.85rem;
  white-space: nowrap;
}
.btn-delete-perm span {
  display: inline-block;
  width: 14px;
  height: 14px;
  background: var(--color-duedate-past, #dc2626);
  -webkit-mask: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIj8+CjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2aWV3Qm94PSIwIDAgMTYgMTYiPjxnIHN0cm9rZS13aWR0aD0iMS4yIiBmaWxsPSJub25lIj48cGF0aCBkPSJNMTIuMCAxMi4wbC04LTgiIHN0cm9rZT0iIzAwMCIvPjxwYXRoIGQ9Ik00LjAgMTIuMGwrOC04IiBzdHJva2U9IiMwMDAiLz48L2c+PC9zdmc+Cg==') center/contain no-repeat;
  mask: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIj8+CjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2aWV3Qm94PSIwIDAgMTYgMTYiPjxnIHN0cm9rZS13aWR0aD0iMS4yIiBmaWxsPSJub25lIj48cGF0aCBkPSJNMTIuMCAxMi4wbC04LTgiIHN0cm9rZT0iIzAwMCIvPjxwYXRoIGQ9Ik00LjAgMTIuMGwrOC04IiBzdHJva2U9IiMwMDAiLz48L2c+PC9zdmc+Cg==') center/contain no-repeat;
  flex-shrink: 0;
}
.btn-delete-perm:hover {
  background: #fef2f2;
}
.trash-info {
  font-size: 0.85rem;
  color: var(--color-text-reduced2, #888);
  margin: 8px 0;
  padding: 8px 12px;
  background: var(--color-toolbar, #f9fafb);
  border-radius: 6px;
  border: 1px solid var(--color-border-default, #e5e7eb);
}

/* Modern Settings Panel */
.settings-container {
  max-width: 100%;
  margin: 0 auto;
  padding: 0 12px;
}

.cat-manager { width: 100%; }
.cat-add-form { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.cat-add-form input[type="text"] { flex: 1; min-width: 120px; padding: 6px 10px; border: 1px solid var(--color-border); border-radius: 6px; font-size: 13px; font-family: inherit; }
.cat-add-form input[type="color"] { width: 34px; height: 34px; padding: 2px; border: 1px solid var(--color-border); border-radius: 6px; cursor: pointer; }
.cat-btn { display: inline-flex; align-items: center; gap: 4px; padding: 6px 14px; border: none; border-radius: 6px; font-size: 13px; font-weight: 500; cursor: pointer; font-family: inherit; transition: background 0.15s; }
.cat-btn-add { background: var(--color-link); color: #fff; }
.cat-btn-add:hover { background: var(--color-link-hover); }
#page_ajax .cat-btn-add { background: var(--color-link); color: #fff; }
#page_ajax .cat-btn-add:hover { background: var(--color-link-hover); }
.cat-btn-edit { background: transparent; color: var(--color-text-secondary); padding: 3px 8px; font-size: 12px; }
.cat-btn-edit:hover { color: var(--color-link); background: #f3f4f6; }
.cat-btn-del { background: transparent; color: #dc2626; padding: 3px 8px; font-size: 12px; }
.cat-btn-del:hover { background: #fee2e2; }
.cat-btn-save { background: var(--color-link); color: #fff; padding: 3px 10px; font-size: 12px; }
.cat-btn-save:hover { background: var(--color-link-hover); }
.cat-btn-cancel { background: transparent; border: 1px solid var(--color-border); color: var(--color-text-secondary); padding: 3px 10px; font-size: 12px; }
.cat-btn-cancel:hover { background: #f3f4f6; }
.cat-list { display: flex; flex-direction: column; gap: 4px; }
.cat-item { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: 1px solid var(--color-border); border-radius: 6px; background: var(--color-surface); }
.cat-item:hover { background: #f9fafb; }
.cat-color-dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; border: 1px solid rgba(0,0,0,0.1); flex-shrink: 0; }
.cat-item-name { flex: 1; font-size: 13px; font-weight: 500; }
.cat-item-count { font-size: 11px; color: var(--color-text-secondary); white-space: nowrap; }
.cat-item-actions { display: flex; gap: 2px; flex-shrink: 0; }
.cat-empty { font-size: 13px; color: var(--color-text-secondary); padding: 12px 0; text-align: center; }
.cat-item .cat-inline-edit { display: none; gap: 6px; align-items: center; flex: 1; }
.cat-item .cat-inline-edit.active { display: flex; }
.cat-item .cat-inline-edit input[type="text"] { padding: 3px 6px; font-size: 13px; border: 1px solid var(--color-border); border-radius: 4px; width: 140px; }
.cat-item .cat-inline-edit input[type="color"] { padding: 0; width: 30px; height: 26px; border: 1px solid var(--color-border); border-radius: 4px; }
.cat-item .cat-view-mode { display: flex; align-items: center; gap: 8px; flex: 1; }
.cat-item .cat-view-mode.hidden { display: none; }

/* User Manager */
.user-manager { width: 100%; }
.user-add-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.user-add-form input[type="text"],
.user-add-form input[type="password"] { padding: 6px 10px; border: 1px solid var(--color-border); border-radius: 6px; font-size: 13px; }
.user-btn { display: inline-flex; align-items: center; gap: 4px; padding: 6px 14px; border: none; border-radius: 6px; font-size: 13px; font-weight: 500; cursor: pointer; font-family: inherit; transition: background 0.15s; }
.user-btn-add { background: var(--color-link); color: #fff; }
.user-btn-add:hover { background: var(--color-link-hover); }
#page_ajax .user-btn-add { background: var(--color-link); color: #fff; }
#page_ajax .user-btn-add:hover { background: var(--color-link-hover); }
.user-list { display: flex; flex-direction: column; gap: 4px; }
.user-item { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: 1px solid var(--color-border); border-radius: 6px; background: var(--color-surface); }
.user-item:hover { background: #f9fafb; }
.user-name { flex: 1; font-size: 13px; font-weight: 600; }
.user-display { font-size: 12px; color: var(--color-text-secondary); min-width: 100px; }
.user-role { font-size: 11px; padding: 2px 6px; border-radius: 4px; background: #e5e7eb; }
.user-actions { display: flex; gap: 4px; flex-shrink: 0; }
.user-actions button { padding: 3px 8px; border: none; border-radius: 4px; font-size: 11px; cursor: pointer; font-family: inherit; }
.user-pw-btn { background: #e5e7eb; color: #374151; }
.user-pw-btn:hover { background: #d1d5db; }
.user-del-btn { background: #fee2e2; color: #dc2626; }
.user-del-btn:hover { background: #fecaca; }
.user-empty { font-size: 13px; color: var(--color-text-secondary); padding: 8px 0; }

.settings-section {
  background: var(--color-bg, #fff);
  border: 1px solid var(--color-border-default, #e0e0e0);
  border-radius: 10px;
  margin-bottom: 16px;
  overflow: hidden;
}
.settings-section-title {
  font-weight: 700;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 12px 16px;
  background: var(--color-tab, #f8f9fa);
  border-bottom: 1px solid var(--color-border-default, #e0e0e0);
  color: var(--color-text-reduced2, #666);
}
.settings-row {
  display: flex;
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-border-default, #f0f0f0);
}
.settings-row:last-child { border-bottom: none; }
.settings-label {
  width: 140px;
  flex-shrink: 0;
  font-weight: 600;
  font-size: 0.85rem;
  padding-top: 4px;
  color: var(--color-text, #333);
}
.settings-input {
  flex: 1;
  font-size: 0.85rem;
}
.settings-input input[type="text"],
.settings-input input[type="password"],
.settings-input input[type="number"],
.settings-input select {
  padding: 6px 10px;
  border: 1px solid var(--color-border-default, #ddd);
  border-radius: 6px;
  font-size: 0.85rem;
  background: var(--color-bg, #fff);
  color: var(--color-text, #333);
  outline: none;
  transition: border-color 0.2s;
}
.settings-input input:focus,
.settings-input select:focus {
  border-color: var(--color-link, #4a90d9);
  box-shadow: 0 0 0 2px rgba(74,144,217,0.15);
}
.settings-input input[type="text"] { width: 300px; max-width: 100%; }
.settings-input select { min-width: 160px; }
.toggle-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: 16px;
  cursor: pointer;
  padding: 4px 0;
}
.toggle-label input[type="radio"],
.toggle-label input[type="checkbox"] {
  accent-color: var(--color-link, #4a90d9);
}
.settings-descr {
  display: block;
  font-size: 0.78rem;
  color: var(--color-text-reduced2, #999);
  margin-top: 4px;
}
.settings-subrow {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.settings-subrow:last-child { margin-bottom: 0; }
.settings-subrow-label {
  width: 50px;
  flex-shrink: 0;
  font-size: 0.8rem;
  color: var(--color-text-reduced2, #888);
}
.settings-subrow input { width: 120px !important; }
.settings-footer {
  display: flex;
  gap: 8px;
  padding: 16px 0;
}
.settings-btn-primary {
  padding: 8px 24px;
  background: var(--color-link, #4a90d9);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}
.settings-btn-primary:hover { background: var(--color-link-hover, #357abd); }
.settings-btn-secondary {
  padding: 8px 24px;
  background: var(--color-tab, #f0f0f0);
  color: var(--color-text, #333);
  border: 1px solid var(--color-border-default, #ddd);
  border-radius: 6px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.2s;
}
.settings-btn-secondary:hover { background: var(--color-tab-hover, #e0e0e0); }
.settings-json-box {
  padding: 16px;
}
.settings-json-box label {
  font-weight: 600;
  display: block;
  margin-bottom: 8px;
}
.settings-json-box textarea {
  width: 100%;
  height: 300px;
  font-family: monospace;
  font-size: 0.8rem;
  padding: 8px;
  border: 1px solid var(--color-border-default, #ddd);
  border-radius: 6px;
  background: var(--color-bg, #fff);
  color: var(--color-text, #333);
}

@media (max-width: 700px) {
  #sidebar {
    position: fixed;
    top: 0;
    left: -260px;
    width: 240px;
    height: 100vh;
    z-index: 10001;
    margin: 0;
    border-radius: 0;
    border-right: 1px solid rgba(148, 163, 184, 0.15);
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    box-shadow: 4px 0 24px rgba(0,0,0,0.15);
  }
  #sidebar.open {
    left: 0;
  }
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 10000;
  }
  .sidebar-overlay.active {
    display: block;
  }
  #sidebar-toggle {
    display: inline-flex !important;
  }
}
#sidebar-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(148, 163, 184, 0.15);
  border-radius: 8px;
  background: #1e293b;
  cursor: pointer;
  color: #94a3b8;
  transition: all 0.2s ease;
}
#sidebar-toggle:hover {
  background: rgba(99, 102, 241, 0.12);
  border-color: #6366f1;
  color: #e2e8f0;
}
#sidebar-toggle svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
}

a.mtt-back-button {
  font-size:1rem;
}
h3.page-title a.mtt-back-button {
  display:inline-block;
  width:1.3rem;
  min-width:1.3rem;
  height:1.3rem;
  padding-right:0.4rem;
  position: relative;
  top:4px;
  mask: url(images/back.svg) no-repeat; -webkit-mask: url(images/back.svg) no-repeat;
  background-color: var(--color-btn-default);
}


/* Tasklist */

.task-toggle {
  visibility: hidden;
  cursor: pointer;
  width: 1rem;
  height: 1rem;
  display: inline-block;
  margin-right: 4px;
  mask: var(--svg-note-toggle) no-repeat; -webkit-mask: var(--svg-note-toggle) no-repeat;
  background-color: var(--color-btn-reduced);
  transition: transform .15s ease, background-color .15s ease;
}
.task-toggle::after {
  content:'0';
  color:transparent;
}
.task-toggle:hover {
  background-color: var(--color-btn-reduced-hover);
}
li.task-row.task-has-note .task-toggle { visibility:visible; }
li.task-row.task-expanded .task-toggle { transform:rotate(90deg); }

#tasklist { list-style-type: none; margin: 0; padding: 0;}
#tasklist li.task-row {
  border: 1px solid var(--color-border-default, #e5e7eb);
  border-radius: 8px;
  margin-bottom: 6px;
  min-height: 20px;
  background-color: var(--color-tasklist-row);
  position: relative;
  transition: box-shadow 0.2s ease, transform 0.15s ease;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}
#mtt:not(.touch-device) #tasklist li.task-row:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  border-color: var(--color-border-focus, #4F46E5);
}
#mtt:not(.touch-device) #tasklist li.task-row.menu-active {
  z-index: 1;
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
  border-radius: 8px;
  border-color: var(--color-border-focus, #4F46E5);
}
#tasklist .task-block {
   display: flex;
   justify-content: flex-start;
   align-items: stretch;
   padding: 0.6rem 8px;
}
#tasklist li.task-row.task-expanded {
  border: 1px solid var(--color-tasklist-row-expanded-border);
  border-radius: 8px;
  background-color: var(--color-bg, #fff);
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}
#tasklist li.task-row.task-has-note.task-expanded .task-block {
  border-bottom: 1px solid var(--color-tasklist-row-inter-border);
}
.task-left {
  display: flex;
  align-items: center;
  height: 1.2rem;
}
.task-middle {
  flex-grow:1;
  margin: -0.6rem 0px;
  padding: 0.6rem 0px;
  margin-left: 8px;
  align-items: baseline;
  line-height: 1.2rem;
  min-width: 0;
}
.task-middle-top {
  display: flex;
}
.task-through-right {
  flex-shrink: 0;
  white-space: nowrap;
  margin-left: 4px;
  align-self: center;
}
.task-actions {
  flex:0 0 1rem;
  margin-left:5px;
}

.task-left label { min-width:18px; text-align:center; }
.task-date {
  color: var(--color-text-reduced3);
  font-size: 0.8rem;
  display: inline-block;
  margin:0;
  margin-left:3px;
}
.task-id::after {
  content: ' \00b7 ';
}
#mtt.show-date .task-date,
#mtt.show-date.date-inline .task-date {
  display: inline-block !important;
  margin:0;
  margin-left:3px;
}
.task-through { overflow:hidden; flex-grow:1; }
#mtt.view-task-on-click .task-title {
  cursor: pointer;
}
.task-title a {
  color: var(--color-text-default);
}
.task-title a:hover {
  color: var(--color-tasklist-link-hover);
}
#mtt.readonly #tasklist li.task-row .task-actions { display:none; }
.task-listname {
  background-color: var(--color-tasklist-listname-bg);
  color: var(--color-tasklist-listname);
  padding: 1px 6px;
  margin: 0px 2px;
  border-radius: 4px;
  font-size: 0.85rem;
}
.task-tags {
  margin:0px 3px;
  display: inline;
}
.task-tags:empty {
  margin:0;
}
.task-tags .tag {
  font-size:0.85rem;
  font-weight:500;
  color: var(--color-tasklist-tag);
  text-decoration:underline;
  cursor: pointer;
}
.recurring-icon {
  cursor: default;
  font-size: 1.1rem;
  margin-left: 2px;
  vertical-align: middle;
}
li.task-row.task-completed .recurring-icon { opacity:0.4; }

.subtask-progress-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 10px;
  background: #E5E7EB;
  color: #4B5563;
  vertical-align: middle;
  margin-left: 4px;
  line-height: 1.4;
}
.subtask-progress-badge:empty { display: none; }

.duedate { color:var(--color-duedate-default); padding:0px; padding-left:1px; margin-left:5px; white-space:nowrap; }
.duedate:before {
  content:'\2192\20';
  font-family: -apple-system, "Segoe UI", "DejaVu Sans", sans-serif;
}
li.task-row.task-completed .duedate { display:none; }
#tasklist li.task-row.soon  .duedate { color: var(--color-duedate-soon); }
#tasklist li.task-row.today .duedate { color: var(--color-duedate-today); }
#tasklist li.task-row.past  .duedate { color: var(--color-duedate-past); }

#tasklist li.task-row.task-completed  { opacity:0.5; }
#tasklist li.task-row.task-completed .task-through { text-decoration:line-through; }
#tasklist li.task-row.task-completed:hover { opacity:1.0; }

#tasklist li.task-row.not-in-tagpreview  {
  opacity: 0.1;
}
#tasklist .mtt-task-placeholder {
 min-height: 0px;
 padding: 0px;
 height: 18px;
 line-height: 18px;
 background-color: var(--color-placeholder);
 border: 1px solid var(--color-placeholder-border);
 border-radius: 6px;
}

.taskactionbtn {
  height: 1rem;
  width: 1rem;
  visibility: hidden;
  mask: url(images/task-menu2.svg) no-repeat; -webkit-mask: url(images/task-menu2.svg) no-repeat;
  background-color: var(--color-btn-reduced);
  transition: background-color 0.15s ease;
}
.taskactionbtn::after {
  content:'0';
  color:transparent;
}
li.task-row:hover .taskactionbtn {
  visibility:visible;
}
.taskactionbtn:hover,
.taskactionbtn.mtt-menu-button-active {
  visibility:visible;
  cursor:pointer;
  background-color: var(--color-btn-reduced-hover);
}

#tasklist.filter-past  li.task-row,
#tasklist.filter-today li.task-row,
#tasklist.filter-soon  li.task-row {
  display:none;
}
#tasklist.filter-past  li.task-row.past,
#tasklist.filter-today li.task-row.today,
#tasklist.filter-soon  li.task-row.today,
#tasklist.filter-soon  li.task-row.soon {
  display:block;
}
#tasklist.filter-past  li.task-row.task-completed,
#tasklist.filter-today li.task-row.task-completed,
#tasklist.filter-soon  li.task-row.task-completed {
  display:none;
}

#tasklist.filter-highprio li.task-row {
  display:none;
}
#tasklist.filter-highprio li.task-row.prio-1,
#tasklist.filter-highprio li.task-row.prio-2 {
  display:block;
}
#tasklist.filter-highprio li.task-row.task-completed {
  display:none;
}

#quickfilterbar {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 2px 0 4px 12px;
  border-bottom: 1px solid var(--color-border-default);
  background: var(--color-toolbar-bg, transparent);
}
.quickfilter-item {
  display: inline-block;
  padding: 2px 8px;
  font-size: 0.78rem;
  border-radius: 10px;
  cursor: pointer;
  color: var(--color-text-reduced2, inherit);
  transition: background-color 0.15s ease, color 0.15s ease;
  user-select: none;
}
.quickfilter-item:hover {
  background: var(--color-btn-reduced-hover);
  color: var(--color-text);
}
.quickfilter-item.active {
  background: var(--color-link, #4F46E5);
  color: var(--color-bg, #fff);
  font-weight: 600;
}

.task-note-block {
  padding: 12px 2rem;
  color: var(--color-text-reduced);
  background-size:16px 16px;
  min-height:16px;
  display:none;
  white-space:normal;
  word-wrap:break-word;
}
li.task-row.task-expanded .task-note-block { display:block; }
li.task-row.task-completed .task-note-block .task-note { text-decoration:line-through; }
.task-note-area { display:none; margin-bottom:5px; }
.task-note-area textarea { color:var(--color-text-reduced); width:100%; display:block; height:65px; }
.task-note-actions { font-size:0.8rem; }
.hidden { display:none; }
.invisible { visibility:hidden; }
.task-note a { color: var(--color-tasklist-note-link); }
.task-note a:hover { color: var(--color-tasklist-link-hover) }

/* Subtasks */
.subtask-list {
  margin-top: 6px;
  padding-left: 0;
}
.subtask-item {
  display: flex;
  align-items: center;
  padding: 4px 0;
  border-top: 1px solid var(--color-tasklist-row-inter-border);
  font-size: 0.9rem;
}
.subtask-item.subtask-completed .subtask-title {
  text-decoration: line-through;
  opacity: 0.5;
}
.subtask-left {
  flex: 0 0 auto;
  margin-right: 6px;
}
.subtask-left label {
  min-width: 18px;
  text-align: center;
}
.subtask-middle {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.subtask-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.subtask-title-link {
  color: inherit;
  text-decoration: none;
}
.subtask-title-link:hover {
  text-decoration: underline;
  color: var(--color-link);
}
.task-title-link {
  color: inherit;
  text-decoration: none;
}
.task-title-link:hover {
  text-decoration: underline;
  color: var(--color-link);
}
.subtask-status-badge {
  font-size: 0.65rem;
  padding: 1px 5px;
  border-radius: 8px;
  white-space: nowrap;
  text-transform: uppercase;
  font-weight: 600;
}
.subtask-status-badge.badge-status-in_progress {
  background: #DBEAFE;
  color: #1E40AF;
}
.subtask-status-badge.badge-status-blocked {
  background: #FEE2E2;
  color: #991B1B;
}
.subtask-attach-icon {
  font-size: 0.8rem;
  cursor: default;
  opacity: 0.6;
}
.subtask-due {
  font-size: 0.8rem;
  color: var(--color-duedate-default);
  white-space: nowrap;
  flex-shrink: 0;
}
.subtask-due:before {
  content: '\2192\20';
  font-family: -apple-system, "Segoe UI", "DejaVu Sans", sans-serif;
}
.subtask-date {
  font-size: 0.75rem;
  color: var(--color-text-reduced3, #888);
  margin-left: 4px;
  white-space: nowrap;
  flex-shrink: 0;
}
.subtask-date:before {
  content: '\2022\20';
}
.due-remaining {
  font-size: 0.75rem;
  white-space: nowrap;
  margin-left: 4px;
  color: var(--color-duedate-default);
}
.due-remaining.overdue {
  color: var(--color-duedate-past);
  font-weight: 600;
}
.due-remaining.due-today {
  color: var(--color-duedate-today);
  font-weight: 600;
}
.due-remaining.no-due {
  color: var(--color-text-reduced3);
  font-style: italic;
}
.subtask-actions {
  flex: 0 0 auto;
  margin-left: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.subtask-edit, .subtask-delete {
  cursor: pointer;
  color: var(--color-text-reduced3);
  font-size: 1rem;
  line-height: 1;
}
.subtask-edit:hover {
  color: var(--color-link);
}
.subtask-delete:hover {
  color: var(--color-error-bg);
}
.subtask-edit-form {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
  margin-left: 24px;
  padding: 4px 0;
}
.subtask-edit-title {
  flex: 1;
  min-width: 100px;
  padding: 4px 8px;
  font-size: 0.85rem;
  border: 1px solid var(--color-border-default);
  border-radius: 6px;
}
.subtask-edit-duedate {
  width: 90px;
  padding: 4px 8px;
  font-size: 0.85rem;
  border: 1px solid var(--color-border-default);
  border-radius: 6px;
}
.subtask-edit-repeat, .subtask-repeat-input {
  padding: 4px 8px;
  font-size: 0.85rem;
  border: 1px solid var(--color-border-default);
  border-radius: 6px;
}
.subtask-edit-estimate, .subtask-estimate-input {
  width: 70px;
  padding: 4px 8px;
  font-size: 0.85rem;
  border: 1px solid var(--color-border-default);
  border-radius: 6px;
}
.subtask-edit-submit, .subtask-edit-cancel {
  padding: 4px 10px;
  font-size: 0.8rem;
  cursor: pointer;
  border: 1px solid var(--color-border-default);
  border-radius: 6px;
  background: var(--color-submit);
  transition: background-color 0.15s ease;
}
.subtask-edit-submit:hover, .subtask-edit-cancel:hover {
  background: var(--color-submit-hover);
}
.subtask-add-form {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
  padding: 4px 0;
}
.subtask-input {
  flex: 1;
  min-width: 100px;
  padding: 4px 8px;
  font-size: 0.85rem;
  border: 1px solid var(--color-border-default);
  border-radius: 6px;
}
.subtask-duedate-input {
  width: 90px;
  padding: 4px 8px;
  font-size: 0.85rem;
  border: 1px solid var(--color-border-default);
  border-radius: 6px;
}
.subtask-submit, .subtask-cancel {
  padding: 4px 10px;
  font-size: 0.8rem;
  cursor: pointer;
  border: 1px solid var(--color-border-default);
  border-radius: 6px;
  background: var(--color-submit);
  transition: background-color 0.15s ease;
}
.subtask-submit:hover, .subtask-cancel:hover {
  background: var(--color-submit-hover);
}

/* Subtask show/hide toggle */
.task-has-subtasks .task-toggle {
  visibility: visible;
  cursor: pointer;
}
.task-has-subtasks:not(.subtasks-visible) .subtask-list,
.task-has-subtasks:not(.subtasks-visible) .subtask-add-form,
.task-has-subtasks:not(.subtasks-visible) .task-progress,
.task-has-subtasks:not(.subtasks-visible) .task-progress-text,
.task-has-subtasks:not(.subtasks-visible) .subtask-sort-bar {
  display: none;
}

/* Subtask drag handle */
.subtask-drag-handle {
  flex: 0 0 auto;
  width: 16px;
  text-align: center;
  cursor: grab;
  color: var(--color-text-reduced3, #999);
  font-size: 0.85rem;
  line-height: 1;
  user-select: none;
  opacity: 0.3;
  transition: opacity 0.15s ease;
}
.subtask-item:hover .subtask-drag-handle {
  opacity: 0.7;
}
.subtask-drag-handle:active {
  cursor: grabbing;
}

/* Subtask sort bar and button */
.subtask-sort-bar {
  margin-top: 4px;
  padding: 2px 0;
}
.subtask-sort-btn {
  font-size: 0.75rem;
  padding: 2px 8px;
  cursor: pointer;
  border: 1px solid var(--color-border-default);
  border-radius: 4px;
  background: var(--color-submit);
  color: var(--color-text);
  transition: background-color 0.15s ease;
}
.subtask-sort-btn:hover {
  background: var(--color-submit-hover);
}

/* Sortable placeholder for subtask drag */
.subtask-placeholder {
  height: 2.2em;
  border: 1px dashed var(--color-border-default);
  background: var(--color-tasklist-row-inter-border);
  border-radius: 4px;
  margin: 2px 0;
}

/* Task indicators: repeat, estimate, attachment count */
.task-repeat-icon {
  display: inline-block;
  font-size: 0.85rem;
  color: var(--color-link);
  margin-left: 4px;
  cursor: default;
}
.task-estimate {
  display: inline-block;
  font-size: 0.75rem;
  color: var(--color-text-reduced3);
  background: var(--color-border-default);
  border-radius: 4px;
  padding: 0 6px;
  margin-left: 4px;
}
.task-attachment-count {
  display: inline-block;
  font-size: 0.75rem;
  color: var(--color-text-reduced3);
  margin-left: 4px;
  cursor: pointer;
}
.task-attachment-count:hover {
  color: var(--color-link);
}

/* Attachments in edit form */
#attachments_list {
  margin-top: 4px;
}
.attachment-item {
  display: flex;
  flex-direction: column;
  padding: 6px 8px;
  border: 1px solid var(--color-border-default);
  border-radius: 6px;
  margin-bottom: 4px;
  font-size: 0.85rem;
  background: #fff;
}
.attachment-item.attachment-image {
  padding: 0;
}
.attachment-info {
  display: flex;
  align-items: center;
  padding: 6px 8px;
}
.attachment-image .attachment-info {
  padding: 6px 8px;
}
.attachment-preview-link {
  display: block;
  border-bottom: 1px solid var(--color-border-default);
  line-height: 0;
}
.attachment-preview-img {
  max-width: 100%;
  max-height: 200px;
  object-fit: contain;
  border-radius: 6px 6px 0 0;
  cursor: pointer;
}
.attachment-link {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--color-link);
  min-width: 0;
}
.attachment-link:hover {
  text-decoration: underline;
}
.attachment-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.attachment-size {
  color: var(--color-text-reduced3);
  font-size: 0.8rem;
  white-space: nowrap;
}
.attachment-delete-btn {
  cursor: pointer;
  color: var(--color-text-reduced3);
  font-size: 1.1rem;
  margin-left: 8px;
  padding: 0 4px;
  line-height: 1;
}
.attachment-delete-btn:hover {
  color: var(--color-error-bg);
}
.attachment-upload-area {
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.attachment-upload-btn {
  padding: 5px 12px;
  font-size: 0.8rem;
  cursor: pointer;
  border: 1px solid var(--color-border-default);
  border-radius: 6px;
  background: var(--color-submit);
  transition: background-color 0.15s ease;
}
.attachment-upload-btn:hover {
  background: var(--color-submit-hover);
}
.attachment-hint {
  font-size: 0.75rem;
  color: var(--color-text-reduced3);
}
.attachment-empty {
  color: var(--color-text-reduced3);
  font-size: 0.85rem;
  font-style: italic;
}

.attachment-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  max-width: 200px;
}
.attachment-progress-bar {
  height: 6px;
  background: var(--color-link, #4F46E5);
  border-radius: 3px;
  transition: width 0.2s ease;
  min-width: 0;
  flex: 1;
}
.attachment-progress-text {
  font-size: 0.75rem;
  color: var(--color-text-reduced3);
  white-space: nowrap;
}

#global_upload_progress {
  position: fixed;
  bottom: 16px;
  right: 16px;
  background: var(--color-bg, #fff);
  border: 1px solid var(--color-border-default);
  border-radius: 8px;
  padding: 12px 16px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  z-index: 10000;
  min-width: 220px;
}
.global-upload-progress-inner {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
#global_upload_filename {
  font-size: 0.82rem;
  color: var(--color-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 260px;
}
.global-upload-progress-track {
  height: 8px;
  background: var(--color-border-default);
  border-radius: 4px;
  overflow: hidden;
}
.global-upload-progress-bar {
  height: 100%;
  background: var(--color-link, #4F46E5);
  border-radius: 4px;
  transition: width 0.2s ease;
  width: 0%;
}
#global_upload_pct {
  font-size: 0.75rem;
  color: var(--color-text-reduced3);
  text-align: right;
}

.task-prio { padding-left:2px; padding-right:2px; margin-left:0px; margin-right:5px; cursor:default; }
.prio-neg { background-color:var(--color-priority-low); color: var(--color-priority-text); }
.prio-pos { background-color:var(--color-priority-urgent); color:var(--color-priority-text); }
.prio-pos-1 { background-color:var(--color-priority-high); color:var(--color-priority-text); }
.prio-zero { background-color:var(--color-link); color:var(--color-priority-text); }

/* */

#tasks_info {
  display: flex;
  justify-content: center;
  align-content: center;
  flex-direction: column;
  min-height: 100px;
  border: 1px solid var(--color-border-default);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}
#tasks_info .v {
  font-size: 1.1rem;
  font-weight: 600;
  text-align: center;
}

.form-container {
  display: flex;
  flex-wrap: wrap;
}
.form-row {
  margin-top:0.6rem;
}
.form-row-short {
  margin-right:12px;
}
.form-row:not(.form-row-short) {
  width:100%;
}
.form-row .h {
  font-weight:600;
  color: var(--color-text-reduced);
}
.form-row div.h {
  margin-bottom:3px;
}
.form-input {
  color: var(--color-text-reduced);
}
.form-input.in100 {
  width:100px;
}
.form-input.inmax {
  width:100%;
  box-sizing:border-box;
}
textarea.form-input.inmax {
  height:280px;
  font-size:13px;
  font-family: ui-monospace,Consolas,"SF Mono",Menlo,"Liberation Mono",monospace;
  white-space: pre;
  padding: 8px;
  border-radius: 6px;
}
.alltags-cell { width:1%; white-space:nowrap; padding-left:5px; }
#page_taskedit.mtt-inadd .mtt-inedit { display:none; }
#page_taskedit.mtt-inedit .mtt-inadd { display:none; }
#taskedit_id, #taskviewer_id {
  color: var(--color-text-reduced2);
  font-weight: normal;
  margin-left: 5px;
}
#taskedit_info { font-size:1rem; font-weight:normal; color:var(--color-text-reduced2); margin-bottom:6px; }
#taskedit_info > div { margin-top:6px; }

#page_taskviewer h3 {
  display: flex;
  align-items: baseline;
}
#page_taskviewer .container {
  display: flex;
  max-width: 100%;
}
#page_taskviewer .container .left {
  flex-grow: 1;
  min-width: 0;
  border-right: 1px solid var(--color-tasklist-row-expanded-border);
  padding-right: 0.8rem;
}
#page_taskviewer .container .right {
  min-width:300px;
  max-width:300px;
  padding-left: 0.8rem;
  overflow: hidden;
}
#page_taskviewer .container .right .property {
  padding: 1rem 0.5rem;
}
#page_taskviewer .container .right .property:not(:last-child) {
  border-bottom: 1px solid var(--color-tasklist-row-expanded-border);
}
#page_taskviewer .container .right .form-bottom-buttons .mtt-back-button {
  display: none;
}
#page_taskviewer .title {
  word-break: break-word;
}
#page_taskviewer .note {
  line-height: 1.4;
  display: block;
  white-space: normal;
  word-wrap: break-word;
}
#page_taskviewer .no-note {
  color: var(--color-text-reduced3);
  display: none;
}
#page_taskviewer.no-note .no-note {
  display: block;
}
#page_taskviewer.no-note .note {
  display: none;
}
#page_taskviewer .property.tags .content {
  display: inline-flex;
  flex-wrap: wrap;
  max-width: 100%;
}
#mtt.readonly #taskviewer_edit_btn {
  display: none;
}

/* autocomplete */
.ui-helper-hidden-accessible { border: 0; clip: rect(0 0 0 0); height: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute; width: 1px; }
.ui-autocomplete {
  position: absolute;
  padding:0px;
  border:1px solid var(--color-border-default);
  background-color: var(--color-menu);
  overflow:hidden;
  z-index:99999;
  box-shadow: var(--color-popup-shadow);
  border-radius: 8px;
}
.ui-autocomplete .ui-menu-item { margin: 0px; cursor:default; overflow: hidden;  }
.ui-autocomplete .ui-menu-item-wrapper { position: relative; padding:6px 8px; }
.ui-autocomplete .ui-menu-item-wrapper.ui-state-active { background-color:var(--color-menu-hover); color: var(--color-menu-text-hover); }

#priopopup { overflow: hidden; z-index:100;
  background-color: var(--color-menu);
  border:1px solid var(--color-border-default); padding:6px; border-radius: 8px;
  box-shadow: var(--color-popup-shadow); }
#priopopup span { cursor:pointer; border:1px solid var(--color-menu); padding:1px; }
#priopopup .prio-zero:hover { border-color: var(--color-link); }
#priopopup .prio-neg:hover { border-color: var(--color-priority-low); }
#priopopup .prio-pos:hover { border-color: var(--color-priority-urgent); }
#priopopup .prio-pos-1:hover { border-color: var(--color-priority-high); }


#tagcloud .tag,
#alltags .tag,
#page_taskviewer .property.tags .tag {
  display: inline-block;
  padding: 3px 0.6em;
  border-radius: 1em;
  color:var(--color-taglist-tag);
  background-color:var(--color-taglist-tag-bg);
  cursor: pointer;
  background-clip: padding-box;
  border: 1px solid transparent;
  margin-bottom:2px;
  margin-right: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.9em;
  font-weight: normal;
  transition: border-color 0.15s ease;
}
#alltags .tag {
  margin-right: 3px;
}
#page_taskviewer .property.tags .tag {
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom:0;
  margin-top:3px;
}
#tagcloud .tag:hover,
#alltags .tag:hover,
#page_taskviewer .property.tags .tag:hover {
  border-color: var(--color-taglist-tag-hover-bg);
  color: var(--color-taglist-tag-hover);
}

.ui-datepicker {
  width: 250px;
  z-index: 202;
  border: 1px solid var(--color-menu-border);
  background: var(--color-menu);
  display: none;
  padding: 4px;
  box-shadow: var(--color-popup-shadow);
  border-radius: 10px;
}
.ui-datepicker-trigger { cursor:pointer; vertical-align:text-bottom; margin-left:4px; margin-right:4px; width:16px; height:16px; }
.ui-datepicker-calendar { width:100%; border-collapse:collapse; }
.ui-datepicker-calendar thead th { text-align:center; padding:2px; font-size:0.85rem; color: var(--color-text-reduced3); }
.ui-datepicker-calendar tbody td { text-align:right; padding:2px;  }
.ui-datepicker-calendar td a {
  display:block;
  text-decoration:none;
  border:1px solid transparent;
  background-color:transparent;
  color:var(--color-text-reduced);
  padding:4px;
  border-radius: 4px;
}
.ui-datepicker-calendar td.ui-datepicker-current-day a {
  background-color: var(--color-link);
  color: var(--color-menu-text-hover);
  border-color: var(--color-link);
}
.ui-datepicker-calendar td.ui-datepicker-today a {
  color: #fff;
  background-color: var(--color-text-reduced2);
}
.ui-datepicker-calendar td a:hover {
  border-color: var(--color-link);
}
.ui-datepicker-header { padding:4px 0px; }
.ui-datepicker-prev { position:absolute; left:4px; height:20px; text-decoration:none; }
.ui-datepicker-next { position:absolute; right:4px; height:20px; text-decoration:none; }
.ui-datepicker-title { text-align:center; line-height:20px; }
.ui-icon { width:16px; height:16px; text-indent:-99999px; overflow:hidden; }
.ui-datepicker .ui-icon-circle-triangle-w { display:block; position:absolute; top:50%; margin-top:-8px; left:50%;
  mask: url(images/arr-left.svg) no-repeat; -webkit-mask: url(images/arr-left.svg) no-repeat;
  background-color: var(--color-btn-default);
}
.ui-datepicker .ui-icon-circle-triangle-e { display:block; position:absolute; top:50%; margin-top:-8px; right:50%;
  mask: var(--svg-arr-right) no-repeat; -webkit-mask: var(--svg-arr-right) no-repeat;
  background-color: var(--color-btn-default);
}
.ui-datepicker select {
  appearance: none;
  -webkit-appearance: none; -moz-appearance: none;
  background: transparent var(--svg-select) no-repeat top 2px right 4px;
  background-size: 1rem 1rem;
  padding: 2px 4px;
  padding-right: calc(1rem + 7px);
  border: 1px solid var(--color-border-default);
  border-radius: 4px;
  color: var(--color-text-default);
  margin: 0 2px;
}
.ui-datepicker select:focus {
  outline:none;
}

.mtt-menu-button {
  user-select: none;
  cursor:pointer;
  padding:4px;
  transition:background-color 0.15s ease;
}
.mtt-menu-button:hover,
.mtt-menu-button.mtt-menu-button-active {
  background-color: var(--color-btn-hover);
  border-radius:6px;
}

/* Menu */

.mtt-menu-container {
  overflow: hidden;
  max-width: 100vw;
  z-index: 100;
  background-color: var(--color-menu);
  border: 1px solid var(--color-menu-border);
  padding: 4px 0px;
  box-shadow: var(--color-popup-shadow);
  border-radius: 10px;
  user-select: none;
}
.mtt-menu-container.mtt-left-adjusted { margin-left:5px; }
.mtt-menu-container.mtt-right-adjusted { margin-right:5px; }
.mtt-menu-container.mtt-right-adjusted.mtt-left-adjusted { margin-bottom:5px; }
.mtt-menu-container ul { list-style: none; padding:0; margin:0; }
.mtt-menu-container li {
  margin:1px 0px;
  cursor:default;
  color: var(--color-menu-text);
  white-space:nowrap;
  padding-top:6px; padding-bottom:6px; padding-left:28px; padding-right:28px;
  position:relative;
  overflow:hidden;
  text-overflow:ellipsis;
  border-radius: 0;
}
.mtt-menu-container li:hover,
.mtt-menu-container li.mtt-menu-item-active {
  background-color: var(--color-menu-hover);
  color: var(--color-menu-text-hover);
}
.mtt-menu-container li.mtt-item-disabled,
.mtt-menu-container li.mtt-item-disabled a {
  color: var(--color-menu-text-disabled);
}
.mtt-menu-container a {
  display:block;
  cursor:default;
  text-decoration:none;
  outline:none;
  color: var(--color-menu-text);
  overflow:hidden;
  text-overflow:ellipsis;
  }
.mtt-menu-container li:hover a {
  color: var(--color-menu-text-hover);
}
.mtt-menu-container li.mtt-menu-delimiter { height:0px; line-height:0; border-bottom:1px solid var(--color-menu-border); margin:2px -1px; padding:0px; font-size:0px; }
.mtt-menu-container .menu-icon { width:16px; height:16px; position:absolute; left:8px; top:50%; margin-top:-8px; }
li.mtt-item-checked .menu-icon {
  mask: var(--svg-checkmark) no-repeat; -webkit-mask: var(--svg-checkmark) no-repeat;
  background-color: var(--color-btn-default);
}
li.mtt-menu-indicator .submenu-icon {
  position:absolute; right:8px; top:50%; margin-top:-8px;
  width:16px; height:16px;
  mask: var(--svg-arr-right) no-repeat; -webkit-mask: var(--svg-arr-right) no-repeat;
  background-color: var(--color-btn-default);
}
.mtt-menu-container .counter {
  position:absolute; right:8px; top:50%; margin-top:-8px;
  height: 16px; min-width:16px;
  border-radius: 1rem;
  font-size: 0.75rem;
  text-align: center;
  background-color: #6b7280;
  color: white;
  padding: 0 4px;
}
li.mtt-item-hidden { display:none; }

#slmenucontainer li.mtt-list-hidden a { font-style:italic; }
#cmenulistscontainer li.mtt-list-hidden { font-style:italic; }
#mtt.readonly .mtt-need-list { display:none; }
#mtt.readonly .mtt-only-authorized { display:none; }
#mtt.not-admin .mtt-only-admin { display:none; }

/**/

#btnRssFeed .menu-icon { background:var(--svg-rss) no-repeat; }
#btnRssFeed.mtt-item-disabled .menu-icon { background:var(--svg-rss-disabled) no-repeat; }

#task, #search {
  transition: box-shadow .15s ease, border-color .15s ease;
}
#task:focus, #search:focus {
  outline: none;
  border-color: var(--color-border-focus);
  box-shadow: 0 0 0 3px var(--color-border-focus-shadow);
}

.monospace, pre {
  font-family: ui-monospace,Consolas,"SF Mono",Menlo,"Liberation Mono",monospace;
}

.mtt-settings-table {
  width:100%;
}
.mtt-settings-table .tr {
  padding: 10px 0;
  vertical-align:top;
  display: flex;
}
.mtt-settings-table .tr.group-header {
  border-bottom: none !important;
  padding-bottom: 0 !important;
  background-color: unset !important;
}
.mtt-settings-table .group {
  margin-top: 0.75rem;
  margin-bottom: 0.5rem;
  border-radius: 10px;
  background-color: var(--color-settings-row);
}
.mtt-settings-table .group .tr {
  margin: 0 10px;
  padding: 1rem 0;
}
.mtt-settings-table .group .th {
  padding-left: 0;
}
.mtt-settings-table .group .td {
  padding-right: 0;
}
.mtt-settings-table .tr:not(:last-child) {
  border-bottom:1px solid var(--color-row-underlinig);
}
.mtt-settings-table .th, .mtt-settings-table .td {
  padding: 0 10px;
}
.mtt-settings-table .th {
  width: 30%;
  font-weight: 600;
}
.mtt-settings-table .group-header .th {
  font-size: 0.9rem;
}
.mtt-settings-table .td {
  flex-grow: 1;
  line-height: 1.6em;
}
.mtt-settings-table .td.extensions {
  line-height: 1.7em;
}
.mtt-settings-table .descr {
  display: block;
  font-size:0.8rem;
  font-weight:normal;
  color:var(--color-text-reduced2);
  padding-top: 4px;
}
.mtt-settings-table .in350 { min-width:350px; }
.mtt-settings-table .inmax { width:100%; }
.mtt-settings-table textarea.in350 { height:400px; }
.mtt-settings-table textarea.inmax {
  height:400px;
  width:100%;
}
.mtt-settings-table input,
.mtt-settings-table select,
.mtt-settings-table button,
.mtt-settings-table textarea,
.mtt-settings-upload-button {
  padding: 6px 10px;
  border: 1px solid var(--color-border-default);
  border-radius: 6px;
  background-color: var(--color-input-bg);
  color: var(--color-text-default);
}
.mtt-settings-table button:disabled {
  background-color: var(--color-btn-hover);
  color: var(--color-text-reduced2);
}
.mtt-settings-upload-button input[type=file] {
  visibility:hidden;
  position:absolute;
  z-index:-2;
}
.mtt-settings-table select {
  appearance: none;
  -webkit-appearance: none; -moz-appearance: none;
  background: var(--color-input-bg) var(--svg-select) no-repeat top 4px right 5px;
  background-size: 1rem 1rem;
  padding-right: calc(1rem + 10px);
}
.mtt-settings-table input:focus,
.mtt-settings-table select:focus {
  outline:none;
  border-color: var(--color-border-focus);
  box-shadow:0 0 0 3px var(--color-border-focus-shadow);
}
.mtt-settings-table a {
  color: var(--color-text-default);
}
.mtt-settings-table button,
.mtt-settings-upload-button {
  padding: 5px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.15s ease;
}
.mtt-settings-table button:hover,
.mtt-settings-upload-button:hover {
  background-color: var(--color-btn-hover);
}
.mtt-settings-table .form-bottom-buttons button {
  min-width: 5rem;
  padding: 8px 16px;
  margin: 0 6px;
  background-color: var(--color-submit);
  border: 1px solid var(--color-border-default);
  border-radius: 6px;
}
.mtt-settings-table .form-bottom-buttons button:hover {
  background-color: var(--color-submit-hover);
}

#modal {
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
#modal .modal-box {
  min-width: 350px;
  max-width: 1100px;
  border: 1px solid var(--color-menu-border);
  background: var(--color-bg);
  box-shadow: 0 8px 32px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.06);
  border-radius: 12px;
  opacity: 1;
}
#modal .modal-content {
  padding: 2rem;
}
#modal .modal-content input {
  margin-top: 1.5rem;
  width: 100%;
}
#modal input {
  padding: 8px 12px;
  border: 1px solid var(--color-border-default);
  border-radius: 6px;
}
#modal .modal-bottom {
  border-top: 1px solid var(--color-border-default);
  padding: 1rem 1.2rem;
}

/* Progress bar */
.task-progress {
  height: 8px;
  background: var(--color-border-default);
  border-radius: 8px;
  margin-top: 6px;
  overflow: hidden;
}
.task-progress-bar {
  height: 100%;
  background: var(--color-link);
  border-radius: 8px;
  transition: width 0.3s ease;
}
.task-progress-text {
  font-size: 0.72rem;
  color: var(--color-text-reduced3);
  margin-top: 3px;
}

/* font for small screens */
@media only screen and (max-width: 600px),  only screen and (max-height: 600px) {
  html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
  }
  textarea.form-input.inmax { font-size: 14px; }
}



/* ========== narrow screens =========*/
@media only screen and (max-width: 600px) {

  #mtt { padding: 12px 8px 0px; }
  #mtt.page-ajax .topblock { display: none; }
  #mtt.page-taskedit .topblock { display: none; }

  h2 { font-size:1rem; }
  .topblock h2 {
    font-size: 1rem;
    padding-left: 24px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .mtt-img-button { padding:4px; }
  .mtt-menu-button { padding:4px; }
  h3.page-title a.mtt-back-button {
    width: 2rem;
  }
  #page_ajax.mtt-page-settings h3.page-title {
    padding-left: 10px;
    border: none;
  }
  #page_ajax.mtt-page-settings h3.page-title a.mtt-back-button {
    width: 1.5rem;
  }

  .mtt-tabs-new-button { padding-left:0.4rem; padding-right:0.4rem; }

  /* singletab */
  li.mtt-tab { display:none; }
  li.mtt-tab.mtt-tab-selected { display:block; }

  #task { padding:8px; padding-right:22px; margin-left:-26px; }
  #task_placeholder span { padding:8px; }

  .searchbox-c { width:30%; max-width:190px; }
  #toolbar.mtt-intask .searchbox-c { display:none; }
  #toolbar.mtt-insearch .taskbox-c { display:none; }
  #toolbar.mtt-insearch .searchbox-c { width:100%; max-width:100%; }
  #search { padding:8px 24px; border-radius:18px; }

  .task-date {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .task-note-actions { display:block; padding-top:8px; }
  .task-note-block {
    padding-left: 0.625rem;
    padding-right: 0.625rem;
    display: none;
  }
  .task-note-area textarea { width:95%; }
  .taskactionbtn {
    padding: 2px 0.5rem;
    mask-origin: content-box;
    -webkit-mask-origin: content-box;
    visibility: visible;
  }
  .duedate:before {
    content:'\279d\20';
  }

  #tasklist .task-middle-top { flex-direction:column; }
  #tasklist .task-through { white-space:normal; overflow:visible; text-overflow:clip; width:100%; }
  #tasklist .task-through-right { margin-left:0; align-self:flex-start; }
  #tasklist li.task-row.task-expanded .task-note-block { display:none; }
  .task-toggle {
    width: 1.5rem;
    height: 1.5rem;
  }
  #tasklist .mtt-task-placeholder { line-height:1rem; padding-top:0.6rem; padding-bottom:0.6rem; }
  #tasklist .ui-sortable-helper { box-shadow:0px 0px 6px rgba(0,0,0,0.1); opacity: 0.9; border-radius: 8px; }
  #tasklist .ui-sortable-helper .task-left { visibility: hidden }
  #tasklist .ui-sortable-helper .task-actions > * { visibility: hidden }

  #page_taskedit { max-width:100%; border:none; position:static; padding:0; }
  #page_taskedit .form-table { width:100%; }
  #page_taskedit .form-row textarea { height: 150px; }

  #loading {  padding:0px; padding-top:1px; padding-right:1px; height:16px; overflow:hidden; }

  .mtt-settings-table .in350 { min-width:50px; width:100%; }
  .mtt-notes-showhide { display:none; }

  .mtt-menu-container li {
    padding-top: 8px;
    padding-bottom: 8px;
  }

  #page_taskviewer .container {
    flex-direction: column;
  }
  #page_taskviewer .container .left {
    border-right: none;
    padding-right: 0;
  }
  #page_taskviewer .container .right {
    max-width: unset;
    padding-left: 0;
  }
  #page_taskviewer .container .right .property {
    padding: 1rem 0;
  }
  #page_taskviewer .container .right .form-bottom-buttons .mtt-back-button {
    display: block;
  }
  #page_taskviewer .note,
  #page_taskviewer .no-note {
    padding-bottom: 1rem;
    margin-bottom: 1rem;
    border-bottom: 2px solid var(--color-tasklist-row-expanded-border);
  }

  .mtt-settings-table .tr:not(.form-bottom-buttons) {
    display: block;
    background-color:var(--color-settings-row);
    border-radius: 10px;
    padding:12px 16px;
    margin-bottom: 5px;
  }
  .mtt-settings-table .group {
    background-color: var(--color-settings-row);
  }
  .mtt-settings-table .group .tr {
    border-radius: 0;
    padding: 1rem 1rem;
    margin: 0 0;
    margin-bottom: 5px;
    background-color: unset;
  }
  .mtt-settings-table .group .tr:not(:last-child) {
    border-bottom:1px solid var(--color-border-default);
  }
  .mtt-settings-table .group .th {
    padding: 0;
  }
  .mtt-settings-table .th {
    width: auto;
    padding-left: 0px;
  }
  .mtt-settings-table .td {
    padding-top: 4px;
    padding-left: 0px;
  }
  .mtt-settings-table .td.extensions {
    line-height: 2em;
  }
  .mtt-settings-table input,
  .mtt-settings-table select,
  .mtt-settings-table label {
    margin-top:5px;
    box-sizing: border-box;
  }

  .form-bottom-buttons > * {
    padding: 8px;
    border-radius: 8px;
  }

} /* end of @media min 600px */

/* Task viewer attachment list - square thumbnail grid */
.viewer-attachments-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}
.viewer-attachment-item {
  width: 80px;
  text-align: center;
  font-size: 0.7rem;
}
.viewer-attach-thumb {
  width: 80px;
  height: 80px;
  border-radius: 6px;
  border: 1px solid var(--color-border-default);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg-secondary, #f5f5f5);
}
.viewer-attach-thumb.thumb-image {
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
}
.viewer-attach-thumb.thumb-file {
  background: var(--color-border-default, #e0e0e0);
}
.thumb-file-ext {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--color-text-reduced2);
  text-transform: uppercase;
  line-height: 1.1;
  word-break: break-all;
  text-align: center;
  padding: 2px;
}
.viewer-attach-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.viewer-attach-thumb:hover .viewer-attach-overlay {
  opacity: 1;
}
.viewer-attach-dl, .viewer-attach-view {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255,255,255,0.9);
  color: #333;
  font-size: 0.9rem;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.15s ease;
}
.viewer-attach-dl:hover, .viewer-attach-view:hover {
  transform: scale(1.15);
  background: #fff;
  text-decoration: none;
}
.viewer-attach-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 3px;
  color: var(--color-text-reduced2);
}
.viewer-attach-size {
  font-size: 0.65rem;
  color: var(--color-text-reduced3);
}

/* Lightbox overlay */
#attachment_lightbox {
  position: fixed;
  inset: 0;
  z-index: 20000;
  display: flex;
  align-items: center;
  justify-content: center;
}
#attachment_lightbox_bg {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.8);
  cursor: pointer;
}
#attachment_lightbox_content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}
#attachment_lightbox_img {
  max-width: 90vw;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
#attachment_lightbox_close {
  position: absolute;
  top: -36px;
  right: 0;
  color: #fff;
  font-size: 1.8rem;
  cursor: pointer;
  line-height: 1;
  opacity: 0.8;
}
#attachment_lightbox_close:hover {
  opacity: 1;
}
#attachment_lightbox_download {
  display: inline-block;
  margin-top: 12px;
  padding: 6px 18px;
  background: var(--color-link, #4F46E5);
  color: #fff;
  border-radius: 6px;
  text-decoration: none;
  font-size: 0.85rem;
  transition: background 0.15s ease;
}
#attachment_lightbox_download:hover {
  background: var(--color-link-hover, #4338ca);
  text-decoration: none;
}

/* Download button in edit form attachment row */
.attachment-dl-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  margin-left: 4px;
  border-radius: 4px;
  text-decoration: none;
  color: var(--color-link);
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.15s ease;
}
.attachment-dl-btn:hover {
  background: var(--color-btn-reduced-hover);
  text-decoration: none;
}

/* ===== Mobile-Responsive Overhaul ===== */
@media (max-width: 768px) {
  #mtt { padding: 8px; }
  .main-layout { flex-direction: column; }
  #page_tasks,
  #page_dashboard,
  #page_ajax { width: 100%; }
  .sidebar-cat-color { width: 6px; height: 6px; }
}
@media (max-width: 480px) {
  #mtt { padding: 4px; }
  .topblock-title h2 { font-size: 1.2rem; padding-left: 0; }
  .topblock-bar .bar-menu { font-size: 0.8rem; }
  #lists { flex-wrap: wrap; }
  .mtt-tabs { gap: 2px; }
  .mtt-tab { font-size: 0.78rem; margin: 1px; }
  .mtt-tab a { padding: 2px 6px; }
  .newtask-n-search-container { flex-direction: column; gap: 6px; }
  .taskbox-c, .searchbox-c { width: 100%; }
  #toolbar { padding: 4px 0; }
  #quickfilterbar { font-size: 0.75rem; flex-wrap: wrap; gap: 2px; }
  .quickfilter-item { padding: 3px 8px; }
  #category-filter-bar { font-size: 0.72rem; padding: 2px 0 4px 4px; flex-wrap: wrap; }
  #category-filter-select { max-width: 140px; font-size: 0.72rem; }
  h3.page-title { font-size: 0.9rem; }
  #page_tasks h3 { flex-wrap: wrap; }
  .task-block { padding: 6px 4px; }
  .task-title { font-size: 0.85rem; }
  .task-date { font-size: 0.72rem; }
  .task-actions { gap: 2px; }
  .task-actions .mtt-img-button { width: 22px; height: 22px; }
  .dashboard-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .dash-card { padding: 10px; }
  .dash-card-num { font-size: 1.5rem; }
  .settings-row { flex-direction: column; gap: 4px; }
  .settings-label { width: 100%; font-size: 0.8rem; }
  .settings-input input[type="text"] { width: 100%; }
  .settings-subrow { flex-wrap: wrap; }
  #toast-container { left: 8px; right: 8px; bottom: 8px; max-width: none; }
  .toast { font-size: 0.8rem; padding: 8px 12px; }
  .cat-add-form { flex-wrap: wrap; }
  .cat-add-form input[type="text"] { width: 100%; min-width: 0; }
  .cat-item { flex-wrap: wrap; }
  .cat-item .cat-inline-edit { flex-wrap: wrap; }
  .cat-item .cat-inline-edit input[type="text"] { width: 100%; }
}
@media (max-width: 360px) {
  .dash-card-num { font-size: 1.2rem; }
  .mtt-tab { font-size: 0.72rem; }
  .sidebar-cat-item { font-size: 0.75rem; }
}

/* ===== Coming 7 Days Week View ===== */
.week-grid {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
}
.upcoming-split {
  display: flex;
  gap: 12px;
}
.important-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.upcoming-day {
  flex: 1 1 50%;
  min-width: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 10px;
}
.week-day {
  flex: 0 0 160px;
  min-width: 140px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 10px;
}
.week-day-header {
  text-align: center;
  padding-bottom: 8px;
  margin-bottom: 8px;
  border-bottom: 2px solid var(--color-border);
}
.week-day-name {
  font-weight: 600;
  font-size: 13px;
  color: var(--color-text-default);
}
.week-day-date {
  font-size: 11px;
  color: var(--color-text-reduced3);
}
.week-empty {
  text-align: center;
  color: var(--color-text-reduced3);
  font-size: 12px;
  padding: 16px 0;
}
.week-task-card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 8px 10px;
  margin-bottom: 6px;
  font-size: 12px;
  transition: box-shadow 0.15s;
}
.week-task-card:hover {
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.week-subtask-card {
  opacity: 0.85;
  margin-left: 8px;
}
.week-task-title {
  font-weight: 500;
  color: var(--color-text-default);
  margin-bottom: 4px;
  line-height: 1.3;
}
.week-task-link {
  color: var(--color-text-default);
  text-decoration: none;
}
.week-task-link:hover {
  color: var(--color-primary);
  text-decoration: underline;
}
.week-task-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 6px;
  font-size: 10px;
  color: var(--color-text-reduced3);
  align-items: center;
}
.week-list-badge {
  background: var(--color-tasklist-listname-bg, #E5E7EB);
  padding: 1px 6px;
  border-radius: 4px;
  color: var(--color-tasklist-listname, #6B7280);
}
.week-cat-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  vertical-align: middle;
  margin-right: 4px;
}
.week-subtask-list {
  margin-top: 6px;
  padding-top: 4px;
  border-top: 1px dashed var(--color-border);
}
.week-inline-subtask {
  font-size: 11px;
  color: var(--color-text-secondary);
  padding: 2px 0 2px 4px;
  line-height: 1.4;
}
.week-inline-subtask a {
  color: var(--color-text-secondary);
  text-decoration: none;
}
.week-inline-subtask a:hover {
  color: var(--color-primary);
  text-decoration: underline;
}
.week-inline-subtask .week-sub-meta {
  color: var(--color-text-reduced3);
  font-size: 10px;
  margin-left: 4px;
}
.week-sub-parent {
  font-size: 10px;
  color: var(--color-text-reduced3);
  font-style: italic;
}
.week-sub-parent a {
  color: var(--color-text-secondary);
  text-decoration: none;
}
.week-sub-parent a:hover {
  color: var(--color-primary);
  text-decoration: underline;
}

@media (max-width: 600px) {
  .upcoming-split {
    flex-direction: column;
  }
  .upcoming-day {
    width: 100%;
  }
  .week-grid {
    flex-direction: column;
    overflow-x: visible;
  }
  .week-day {
    flex: none;
    width: 100%;
  }
}

/* ============ AI Assistant / AI Intelligence Hub ============ */

/* Quick capture */
.ai-quickcapture-c {
  display: flex;
  flex: 1 1 260px;
  max-width: 420px;
  min-width: 0;
}
.ai-quickcapture {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 0 6px 0 10px;
  border: 1px solid var(--color-border-default);
  border-radius: 6px;
  background: var(--color-input-bg);
  transition: border-color .15s;
}
.ai-quickcapture:focus-within {
  border-color: var(--color-border-focus);
  box-shadow: 0 0 0 2px var(--color-border-focus-shadow, rgba(79,70,229,.15));
}
.ai-quickcapture-icon {
  flex: none;
  width: 14px;
  height: 14px;
  color: var(--color-link);
}
#ai_quickcapture {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  color: var(--color-text-default);
  font-size: 13px;
  padding: 7px 0;
}
.ai-quickcapture-send {
  flex: none;
  cursor: pointer;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-reduced2);
  font-size: 14px;
  user-select: none;
}
.ai-quickcapture-send:hover {
  background: var(--color-btn-hover);
  color: var(--color-link);
}

/* Focus button */
.focus-btn {
  border: 1px solid var(--color-border-default);
  background: var(--color-btn-hover);
  color: var(--color-text-reduced);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
  margin-left: 8px;
}
.focus-btn:hover {
  background: var(--color-btn-toolbar-hover);
  border-color: var(--color-link);
  color: var(--color-link);
}

/* AI page */
#page_ai {
  max-width: 980px;
  margin: 0 auto;
  width: 100%;
  padding: 8px 16px 24px;
  box-sizing: border-box;
}
.ai-header { margin-bottom: 12px; }
.ai-title-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.ai-context-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--color-text-reduced2);
  background: var(--color-toolbar);
  border: 1px solid var(--color-border-default);
  border-radius: 12px;
  padding: 3px 10px;
}
.ai-context-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #34d399;
}
.ai-context-label { color: var(--color-text-reduced); font-weight: 600; }
.ai-context-edit a { color: var(--color-link); }

/* chips */
.ai-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 10px 0 14px;
}
.ai-chip {
  border: 1px solid var(--color-border-default);
  background: var(--color-toolbar);
  color: var(--color-text-reduced);
  border-radius: 16px;
  padding: 5px 12px;
  font-size: 12px;
  cursor: pointer;
  transition: all .15s;
}
.ai-chip:hover {
  border-color: var(--color-link);
  color: var(--color-link);
  background: var(--color-btn-hover);
}

/* chat */
.ai-chat {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: 56vh;
  min-height: 260px;
  overflow-y: auto;
  padding: 6px 4px;
  scroll-behavior: smooth;
}
.ai-chat-welcome {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: var(--color-toolbar);
  border: 1px dashed var(--color-border-default);
  border-radius: 10px;
  padding: 16px;
  color: var(--color-text-reduced);
  font-size: 13px;
  line-height: 1.55;
}
.ai-welcome-icon { font-size: 22px; }
.ai-welcome-hint { color: var(--color-text-reduced3); font-size: 12px; }

.ai-msg {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  animation: aiFadeIn .18s ease-out;
}
@keyframes aiFadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.ai-msg-avatar {
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: #fff;
  background: var(--color-link);
  margin-top: 2px;
}
.ai-msg-user .ai-msg-avatar { background: var(--color-text-reduced2); }
.ai-msg-bubble {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13.5px;
  line-height: 1.6;
  overflow-wrap: break-word;
  word-break: break-word;
}
.ai-msg-user { flex-direction: row-reverse; }
.ai-msg-user .ai-msg-bubble {
  background: var(--color-link);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.ai-msg-assistant .ai-msg-bubble {
  background: var(--color-toolbar);
  border: 1px solid var(--color-border-default);
  color: var(--color-text-default);
  border-bottom-left-radius: 4px;
}
.ai-msg-bubble p { margin: 0 0 8px; }
.ai-msg-bubble p:last-child { margin-bottom: 0; }
.ai-msg-bubble ul, .ai-msg-bubble ol { margin: 4px 0 8px; padding-left: 20px; }
.ai-msg-bubble h1, .ai-msg-bubble h2, .ai-msg-bubble h3, .ai-msg-bubble h4 { margin: 10px 0 6px; }
.ai-msg-bubble blockquote {
  margin: 6px 0;
  padding: 2px 10px;
  border-left: 3px solid var(--color-link);
  color: var(--color-text-reduced2);
  background: var(--color-input-bg);
  border-radius: 0 6px 6px 0;
}
.ai-inline-code {
  background: var(--color-input-bg);
  border: 1px solid var(--color-border-default);
  border-radius: 4px;
  padding: 0 4px;
  font-family: Consolas, Monaco, monospace;
  font-size: 12px;
}
.ai-code {
  background: var(--color-input-bg);
  border: 1px solid var(--color-border-default);
  border-radius: 8px;
  padding: 10px 12px;
  overflow-x: auto;
  font-size: 12px;
  margin: 6px 0;
}
.ai-code code { font-family: Consolas, Monaco, monospace; }
.ai-checklist-item { margin: 2px 0; }
.ai-checklist-item input { margin-right: 6px; }

.ai-typing .ai-msg-bubble { min-width: 60px; }
.ai-cursor { animation: aiBlink 1s infinite; }
@keyframes aiBlink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }

/* add-to-tasks blocks */
.ai-tasks-block {
  margin: 8px 0 4px;
  padding-top: 8px;
  border-top: 1px dashed var(--color-border-default);
}
.ai-tasks-header {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: var(--color-text-reduced3);
  margin-bottom: 6px;
}
.ai-add-task-btn {
  display: block;
  width: 100%;
  text-align: left;
  border: 1px solid var(--color-border-default);
  background: var(--color-input-bg);
  color: var(--color-text-default);
  border-radius: 6px;
  padding: 6px 10px;
  margin-bottom: 5px;
  font-size: 12.5px;
  cursor: pointer;
  transition: all .12s;
}
.ai-add-task-btn:hover { border-color: var(--color-link); color: var(--color-link); }
.ai-add-task-btn:disabled { opacity: .6; cursor: default; }

/* input */
.ai-input-area { margin-top: 14px; }
.ai-input-box {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  border: 1px solid var(--color-border-default);
  border-radius: 10px;
  background: var(--color-input-bg);
  padding: 8px 10px;
  transition: border-color .15s, box-shadow .15s;
}
.ai-input-box:focus-within {
  border-color: var(--color-border-focus);
  box-shadow: 0 0 0 2px var(--color-border-focus-shadow, rgba(79,70,229,.15));
}
#ai_input {
  flex: 1;
  min-width: 0;
  resize: none;
  border: none;
  outline: none;
  background: transparent;
  color: var(--color-text-default);
  font-size: 13.5px;
  font-family: inherit;
  line-height: 1.5;
  max-height: 140px;
  padding: 2px 0;
}
.ai-input-btn {
  flex: none;
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: var(--color-text-reduced2);
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.ai-input-btn:hover { background: var(--color-btn-hover); color: var(--color-link); }
.ai-input-btn svg { width: 17px; height: 17px; }
.ai-send-btn { background: var(--color-link); color: #fff; }
.ai-send-btn:hover { background: var(--color-submit-hover); color: #fff; }
.ai-input-hint { margin-top: 6px; font-size: 11px; color: var(--color-text-reduced3); }

/* dashboard widgets */
.ai-dash-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}
.ai-widget {
  background: var(--color-toolbar);
  border: 1px solid var(--color-border-default);
  border-radius: 10px;
  padding: 14px 16px;
}
.ai-widget-title {
  font-weight: 700;
  font-size: 13.5px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.ai-widget-tag {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--color-link);
  background: var(--color-btn-hover);
  border-radius: 10px;
  padding: 2px 8px;
}
.ai-widget-empty, .ai-dash-error {
  color: var(--color-text-reduced3);
  font-size: 12.5px;
  padding: 10px 0;
}
.ai-briefing-card { grid-column: 1 / -1; }
.ai-briefing-text { font-size: 13px; line-height: 1.65; color: var(--color-text-reduced); }
.ai-briefing-text p { margin: 0 0 8px; }
.ai-briefing-text p:last-child { margin: 0; }

/* matrix */
.ai-matrix-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.ai-matrix-cell {
  border: 1px solid var(--color-border-default);
  border-radius: 8px;
  padding: 8px;
  background: var(--color-input-bg);
  min-height: 90px;
}
.ai-matrix-cell.q1 { border-left: 3px solid #ef4444; }
.ai-matrix-cell.q2 { border-left: 3px solid #34d399; }
.ai-matrix-cell.q3 { border-left: 3px solid #f59e0b; }
.ai-matrix-cell.q4 { border-left: 3px solid #9ca3af; }
.ai-matrix-cell-head {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--color-text-reduced2);
  margin-bottom: 6px;
  display: flex;
  justify-content: space-between;
}
.ai-matrix-count {
  background: var(--color-btn-hover);
  border-radius: 8px;
  padding: 0 7px;
  font-size: 10.5px;
  color: var(--color-text-reduced2);
}
.ai-matrix-items { display: flex; flex-direction: column; gap: 3px; }
.ai-matrix-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--color-text-default);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ai-matrix-prio { flex: none; width: 7px; height: 7px; border-radius: 50%; }
.ai-prio-2 { background: #ef4444; }
.ai-prio-1 { background: #f59e0b; }
.ai-prio-0 { background: #9ca3af; }
.ai-prio--1 { background: #34d399; }
.ai-matrix-more { font-size: 11px; color: var(--color-text-reduced3); margin-top: 3px; }
.ai-matrix-empty { color: var(--color-text-reduced3); font-size: 11.5px; }

/* load meter */
.ai-meter {
  height: 10px;
  border-radius: 6px;
  background: var(--color-input-bg);
  border: 1px solid var(--color-border-default);
  overflow: hidden;
}
.ai-meter-fill { height: 100%; border-radius: 6px; transition: width .6s ease; }
.ai-meter-low { background: #34d399; }
.ai-meter-medium { background: #f59e0b; }
.ai-meter-high { background: #ef4444; }
.ai-meter-labels {
  display: flex;
  justify-content: space-between;
  font-size: 10.5px;
  color: var(--color-text-reduced3);
  margin: 3px 0 8px;
}
.ai-load-meta { display: flex; gap: 10px; font-size: 12px; color: var(--color-text-reduced2); align-items: center; flex-wrap: wrap; }
.ai-load-level { font-weight: 600; }
.ai-load-low { color: #34d399; }
.ai-load-medium { color: #f59e0b; }
.ai-load-high { color: #ef4444; }
.ai-load-warn {
  margin-top: 8px;
  font-size: 12px;
  color: #b45309;
  background: rgba(245,158,11,.12);
  border: 1px solid rgba(245,158,11,.3);
  border-radius: 6px;
  padding: 6px 10px;
}

/* timeline */
.ai-timeline { display: flex; flex-direction: column; gap: 8px; }
.ai-timeline-row { display: flex; gap: 10px; align-items: center; }
.ai-timeline-time {
  flex: none;
  width: 88px;
  font-size: 11px;
  color: var(--color-text-reduced2);
  font-variant-numeric: tabular-nums;
}
.ai-timeline-track { flex: 1; min-width: 0; }
.ai-timeline-block {
  background: var(--color-input-bg);
  border-radius: 0 6px 6px 0;
  padding: 6px 10px;
  display: flex;
  gap: 8px;
  align-items: baseline;
}
.ai-timeline-title {
  font-size: 12.5px;
  color: var(--color-text-default);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ai-timeline-est {
  flex: none;
  font-size: 10.5px;
  color: var(--color-text-reduced3);
}

/* focus overlay */
#focus_overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,15,20,.55);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.focus-box {
  background: var(--color-bg);
  border: 1px solid var(--color-border-default);
  border-radius: 12px;
  width: 100%;
  max-width: 460px;
  max-height: 80vh;
  overflow-y: auto;
  padding: 20px;
  box-shadow: 0 18px 50px rgba(0,0,0,.25);
}
.focus-header, .weekly-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.focus-title, .weekly-title { font-size: 15px; font-weight: 700; }
.focus-close {
  border: none;
  background: var(--color-btn-hover);
  color: var(--color-text-reduced2);
  width: 26px;
  height: 26px;
  border-radius: 6px;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}
.focus-close:hover { background: #ef4444; color: #fff; }
.focus-sub { font-size: 12px; color: var(--color-text-reduced3); margin-bottom: 12px; }
.focus-progress {
  height: 8px;
  border-radius: 5px;
  background: var(--color-input-bg);
  border: 1px solid var(--color-border-default);
  overflow: hidden;
  margin-bottom: 14px;
}
.focus-progress-fill {
  height: 100%;
  width: 0;
  background: var(--color-link);
  border-radius: 5px;
  transition: width .3s ease;
}
.focus-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.focus-item {
  border: 1px solid var(--color-border-default);
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--color-toolbar);
  transition: opacity .2s;
}
.focus-item-title { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.focus-item-title input { cursor: pointer; }
.focus-item-meta { margin-top: 4px; font-size: 11px; color: var(--color-text-reduced3); }
.focus-done { opacity: .55; }
.focus-done .focus-item-title span { text-decoration: line-through; }

/* weekly review */
#weekly_review_modal {
  position: fixed;
  inset: 0;
  background: rgba(15,15,20,.55);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.weekly-box {
  background: var(--color-bg);
  border: 1px solid var(--color-border-default);
  border-radius: 12px;
  width: 100%;
  max-width: 620px;
  max-height: 82vh;
  overflow-y: auto;
  padding: 22px;
  box-shadow: 0 18px 50px rgba(0,0,0,.25);
}
.weekly-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
  gap: 10px;
  margin: 14px 0;
}
.weekly-stat {
  text-align: center;
  background: var(--color-toolbar);
  border: 1px solid var(--color-border-default);
  border-radius: 8px;
  padding: 10px 6px;
}
.weekly-stat b { display: block; font-size: 19px; color: var(--color-link); }
.weekly-stat span { font-size: 11px; color: var(--color-text-reduced3); }
#weekly_review { font-size: 13px; line-height: 1.65; color: var(--color-text-reduced); }
#weekly_review p { margin: 0 0 8px; }
#weekly_review h4 { margin: 12px 0 6px; font-size: 13.5px; }
#weekly_review ul, #weekly_review ol { padding-left: 20px; }
#weekly_review blockquote {
  margin: 6px 0;
  padding: 2px 10px;
  border-left: 3px solid var(--color-link);
  color: var(--color-text-reduced2);
  background: var(--color-input-bg);
  border-radius: 0 6px 6px 0;
}
.weekly-habits { font-size: 12.5px; color: var(--color-text-reduced2); }

@media (max-width: 760px) {
  .ai-dash-grid { grid-template-columns: 1fr; }
  .ai-msg-bubble { max-width: 92%; }
  .ai-title-row { flex-direction: column; align-items: flex-start; }
}

/* ========== Mobile & touch usability pass ========== */

/* Prevent iOS Safari from zooming into focused inputs */
@media only screen and (max-width: 700px) {
  input[type="text"],
  input[type="password"],
  input[type="number"],
  input[type="email"],
  textarea,
  select {
    font-size: 16px;
  }
}

/* Notch / home-indicator safe areas */
body {
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}
#sidebar {
  padding-bottom: env(safe-area-inset-bottom);
}

@media only screen and (max-width: 700px) {

  /* Never clip dialogs or dropdown menus on narrow viewports */
  #modal .modal-box {
    min-width: 0;
    width: calc(100vw - 20px);
    max-width: calc(100vw - 20px);
  }
  #modal .modal-content {
    padding: 1.2rem 1rem;
    max-height: calc(100vh - 8rem);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .ui-datepicker,
  .mtt-menu-container {
    max-width: calc(100vw - 12px);
  }
  .mtt-menu-container {
    max-height: 60vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Comfortable touch targets */
  .mtt-img-button,
  .mtt-menu-button {
    padding: 8px;
  }
  .task-left label {
    padding: 6px;
    margin: -6px;
  }
  .quickfilter-item {
    padding-top: 8px;
    padding-bottom: 8px;
  }

  /* Stack settings rows earlier than 480px */
  .settings-row {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }
  .settings-input select {
    min-width: 0;
    max-width: 100%;
  }
  .settings-input input[type="text"],
  .settings-input input[type="password"],
  .settings-input input[type="number"] {
    width: 100%;
  }
  .mtt-settings-table .in350 { min-width: 0; width: 100%; }
  .cat-add-form input[type="text"] { width: 100%; min-width: 0; }

  /* Let the header wrap instead of overflowing */
  .topblock-bar {
    flex-wrap: wrap;
    gap: 4px 8px;
  }

  /* Toasts readable without touching screen edges */
  #toast_container {
    left: 10px;
    right: 10px;
    max-width: none;
  }

  /* Full-width submit rows */
  .form-bottom-buttons button {
    margin: 4px 2px;
  }

  /* Two-column stat cards on phones, one on very narrow screens */
  .dashboard-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media only screen and (max-width: 360px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}
