@import url('https://fonts.googleapis.com/css2?family=Noto+Color+Emoji&display=swap');

:root {
  --bd-font-family: 'Inter Tight', Inter, Roboto, -apple-system, Helvetica, Arial, 'Apple Color Emoji', 'Noto Color Emoji', sans-serif;
  --font-family: 'Inter Tight', Inter, Roboto, -apple-system, Helvetica, Arial, 'Apple Color Emoji', 'Noto Color Emoji', sans-serif;
}

:root{
  --primary:#0550FF;
  --secondary:#510CF2;
  --bg:#F6F5FF;
  --surface:#ffffff;
  --text:#110F17;
  --muted:#6b667a;
  --border:#E6E4F4;
  --gray:#E6E4F4;
  --success:#85F485;
  --error:#F48585;
  --radius:12px;
  --shadow:0 6px 24px rgba(17,15,23,0.08);
}

[data-theme="dark"]{
  --bg:#0f0e13;
  --surface:#16141c;
  --text:#f1effa;
  --muted:#bdbad1;
  --border:#2a2735;
  --primary:#6f86ff;
  --secondary:#9a7dff;
  --gray:#2a2735;
  --shadow:0 8px 28px rgba(0,0,0,0.4);

  --note-default-bg: #2a2735;
  --note-default-border: #4a455c;
  --note-red-bg: #4d2424;
  --note-red-border: #7a3a3a;
  --note-blue-bg: #1a2c4d;
  --note-blue-border: #2a4a7d;
  --note-green-bg: #1a4d2c;
  --note-green-border: #2a7d4a;
  --note-yellow-bg: #4d4d1a;
  --note-yellow-border: #7d7d2a;
}

@media (prefers-color-scheme: dark){
  [data-theme="system"]{
    --bg:#0f0e13;
    --surface:#16141c;
    --text:#f1effa;
    --muted:#bdbad1;
    --border:#2a2735;
    --primary:#6f86ff;
    --secondary:#9a7dff;
    --gray:#2a2735;
    --shadow:0 8px 28px rgba(0,0,0,0.4);
  
    --note-default-bg: #2a2735;
    --note-default-border: #4a455c;
    --note-red-bg: #4d2424;
    --note-red-border: #7a3a3a;
    --note-blue-bg: #1a2c4d;
    --note-blue-border: #2a4a7d;
    --note-green-bg: #1a4d2c;
    --note-green-border: #2a7d4a;
    --note-yellow-bg: #4d4d1a;
    --note-yellow-border: #7d7d2a;
  }
}
 
html[data-theme="pretty-pink"]{
  --primary:#ff74a6; 
  --secondary:#ff9ac0; 
  --bg:#fff6fa; 
  --surface:#ffffff;
  --text:#27171e;
  --muted:#7c5e6b;
  --border:#f3d8e5;
  --gray:#f3d8e5;
  --success:#9be7a0;
  --error:#ff9aa2;
  --shadow:0 6px 24px rgba(39,23,30,0.08);
}

 
html[data-theme="dark-pink"]{
  --primary:#ff6b9a; 
  --secondary:#ff92b6;
  --bg:#111017; 
  --surface:#181620; 
  --text:#f6eaf0;
  --muted:#c9b3be;
  --border:#2b2733;
  --gray:#2b2733;
  --success:#6ed6a4;
  --error:#ff7b8a;
  --shadow:0 10px 32px rgba(0,0,0,0.5);
}

 
html[data-theme="dr-pepper"]{
  --primary:#7a0c10; 
  --secondary:#b21f24; 
  --bg:#0f0a0b; 
  --surface:#161012; 
  --text:#f5e9ea;
  --muted:#d2b9bc;
  --border:#2a1a1c;
  --gray:#2a1a1c;
  --success:#7fcf9b;
  --error:#e05555;
  --shadow:0 10px 32px rgba(0,0,0,0.55);
}

 
html[data-theme="forest"]{
  --primary:#22c55e; 
  --secondary:#10b981; 
  --bg:#0b1410; 
  --surface:#101b16; 
  --text:#e8f5ee;
  --muted:#b9d4c6;
  --border:#1c2a23;
  --gray:#1c2a23;
  --success:#6ee7b7;
  --error:#f87171;
  --shadow:0 10px 32px rgba(0,0,0,0.5);
}

 
html[data-theme="leaf"]{
  --primary:#16a34a; 
  --secondary:#2dd4bf; 
  --bg:#f3fbf5;
  --surface:#ffffff;
  --text:#15201a;
  --muted:#5f7a6b;
  --border:#d7e7dd;
  --gray:#d7e7dd;
  --success:#86efac;
  --error:#fca5a5;
  --shadow:0 6px 24px rgba(21,32,26,0.08);
}

 
html[data-theme="pj"]{
  --primary:#ff9933; 
  --secondary:#ffb84d; 
  --bg:#140e2a; 
  --surface:#1a1434; 
  --text:#f4eeff;
  --muted:#cec6e6;
  --border:#2a2250;
  --gray:#2a2250;
  --success:#86efac;
  --error:#fca5a5;
  --shadow:0 10px 32px rgba(0,0,0,0.55);
}

 
html[data-theme="baby-blue"]{
  --primary:#0066cc; 
  --secondary:#40e0d0; 
  --bg:#f0f8ff; 
  --surface:#ffffff; 
  --text:#1a1a2e;
  --muted:#5a6b7a;
  --border:#b8d4e3;
  --gray:#b8d4e3;
  --success:#7fdbda;
  --error:#ff6b6b;
  --shadow:0 6px 24px rgba(26,26,46,0.08);
}

html[data-theme="blueberries"]{
  --primary:#4da6ff; 
  --secondary:#66e6d6; 
  --bg:#0a1a2e; 
  --surface:#102a3f; 
  --text:#e6f3ff;
  --muted:#a8c2d1;
  --border:#1e3a4f;
  --gray:#1e3a4f;
  --success:#5dd5d4;
  --error:#ff8a8a;
  --shadow:0 10px 32px rgba(0,0,0,0.5);
}

 
[data-theme="dark"] .doc-card .type,
html[data-theme="forest"] .doc-card .type,
html[data-theme="pj"] .doc-card .type,
html[data-theme="dr-pepper"] .doc-card .type,
html[data-theme="dark-pink"] .doc-card .type,
html[data-theme="blueberries"] .doc-card .type{
  color:#ffffff;
}

 
.doc-card .type{
  padding:2px 8px; border-radius:999px; background:var(--gray); font-size:12px;
  color: color-mix(in hsl, var(--text) 92%, black 8%);
}

 
[data-theme="dark"],
html[data-theme="forest"],
html[data-theme="pj"],
html[data-theme="dr-pepper"],
html[data-theme="dark-pink"],
html[data-theme="blueberries"]{
  --gray: color-mix(in hsl, var(--surface) 60%, white 40%);
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  --font-family-sans: "Noto Color Emoji", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji",
        "Segoe UI Symbol";
  font-family: var(--bd-font-family);
  color:var(--text);
  background:var(--bg);

  --note-default-bg: #E6E4F4;
  --note-default-border: #C9C5E0;
  --note-red-bg: #F4D8D8;
  --note-red-border: #E0B0B0;
  --note-blue-bg: #D8E4F4;
  --note-blue-border: #B0C0E0;
  --note-green-bg: #D8F4D8;
  --note-green-border: #B0E0B0;
  --note-yellow-bg: #F4F4D8;
  --note-yellow-border: #E0E0B0;
}
img{max-width:100%;display:block}

.topbar{
  position:sticky; top:0; z-index:10;
  display:flex; align-items:center; justify-content:space-between;
  gap:12px; padding:16px 16px; background:var(--bg);
  border-bottom:2px solid var(--border);
}
.topbar .left{display:flex; align-items:center; gap:16px}
.topbar .right{
  position:relative; display:flex; align-items:center; gap:8px
}
.topbar h1{font-size:18px; margin:0}
.logo{width:36px; height:36px}

.container{max-width:1100px; margin:24px auto; padding:0 16px}

.icon-btn{
  appearance:none; border:none; background:transparent;
  padding:4px; border-radius:6px; cursor:pointer; color:var(--text);
  display:inline-flex; align-items:center; justify-content:center; gap:6px;
}
.icon-btn:hover{background:color-mix(in hsl, var(--primary) 10%, var(--surface))}
.icon-btn .material-symbols-outlined{font-variation-settings:"FILL" 0, "wght" 400, "GRAD" 0, "opsz" 24}

.btn{appearance:none; border:none; border-radius:10px; padding:10px 14px; cursor:pointer; font-weight:600; font-family: var(--bd-font-family)}
.btn.primary{background:var(--primary); color:white}
.btn.secondary{background:var(--secondary); color:white}
.btn.outline{background:transparent; border:1px solid var(--border)}
.btn.danger{background:var(--error); color:#110}
.btn:disabled{opacity:.6; cursor:not-allowed}

.input{width:100%; padding:10px 12px; border:1px solid var(--border); border-radius:10px; background:var(--surface); color:var(--text)}

.card-row{display:grid; grid-template-columns:repeat(4, minmax(0,1fr)); gap:12px}
.card{
  background:var(--surface); border:1px solid var(--border); border-radius:14px; padding:12px;
  display:flex; align-items:center; gap:12px; box-shadow:var(--shadow);
  color:inherit; text-decoration:none;
  font-family: var(--bd-font-family);
}
.card.new span.material-symbols-outlined{color:var(--primary)}
.card p{margin:0; color:var(--muted); font-size:12px}

.section-head{display:flex; align-items:center; justify-content:space-between; gap:8px; margin:24px 0 8px}
.link{color:var(--primary); text-decoration:none; font-weight:600}

.doc-grid{display:grid; grid-template-columns:repeat(4, minmax(0,1fr)); gap:12px}
.doc-card{
  position:relative; background:var(--surface); border:1px solid var(--border); border-radius:14px; padding:12px; display:block; color:inherit; box-shadow:var(--shadow)
}
.doc-card .doc-link {
  display: block;
  text-decoration: none;
  color: inherit;
}
.doc-card .thumb{
  height:120px; border:1px dashed var(--border); border-radius:8px;
  padding:12px; color:var(--muted); overflow:hidden;
  display:block; font-size:14px; line-height:1.5;
}
.doc-card .thumb .material-symbols-outlined{
  display:none;
}
.doc-card .thumb:empty::before{
  content: "description";
  font-family: 'Material Symbols Outlined';
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}
.doc-card .meta{display:flex; gap:6px; align-items:center; margin-top:8px; flex-wrap:wrap}
.doc-card .title{flex:1}
.doc-card .type{padding:2px 8px; border-radius:999px; background:var(--gray); color:#333; font-size:12px}
.doc-card .due{font-size:12px; color:var(--muted)}
.doc-card .more{position:absolute; top:8px; right:8px}
.doc-card .menu-container{position:absolute; top:8px; right:8px}

/* Dropdown menu styles */
.dropdown-menu{
  position: fixed; 
  inset: auto auto auto auto; 
  margin: 0;
  background: color-mix(in hsl, var(--surface) 85%, white 15%);
  border: 1px solid var(--border); 
  border-radius: 10px;
  box-shadow: 0 12px 24px rgba(0,0,0,0.18), 0 2px 8px rgba(0,0,0,0.12);
  backdrop-filter: blur(6px);
  min-width: 180px;
  padding: 6px; 
  z-index: 1000; 
}
.dropdown-menu .menu-item{
  display:flex; align-items:center; gap:10px;
  padding:8px 10px; width:100%; border:none; background:transparent; color:var(--text);
  border-radius:8px; cursor:pointer; text-align:left; font-size:14px;
}
.dropdown-menu .menu-item:hover{background:color-mix(in hsl, var(--primary) 12%, var(--surface))}
.dropdown-menu .menu-item.delete{color:#d32f2f}
.dropdown-menu .menu-item.delete:hover{background:color-mix(in hsl, #d32f2f 10%, var(--surface))}

.greeting h2{margin:0 0 6px; font-weight:800}
.greeting .sub{margin:0; color:var(--muted)}

.avatar{
  width:36px; height:36px; 
  border-radius:50%; 
  border:1px solid var(--border); 
  background:var(--primary); 
  color:#fff; 
  display:grid; 
  place-items:center; 
  font-weight:700; 
  position:relative;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.menu{
  position:absolute; right:0; top:44px;
  background:var(--surface); border:1px solid var(--border); border-radius:12px; box-shadow:var(--shadow);
  padding:8px; min-width:220px; display:none; z-index:120
}
.menu.open{display:grid}
.menu-item{display:flex; align-items:center; gap:8px; padding:8px 10px; border-radius:8px; color:inherit; text-decoration:none; background:transparent; border:none; text-align:left; cursor:pointer}
.menu-item:hover{background:color-mix(in hsl, var(--primary) 10%, var(--surface))}

.deadline-list{list-style:none; margin:0; padding:0; display:grid; gap:8px}
.deadline-list li{display:flex; align-items:center; justify-content:space-between; gap:8px; background:var(--surface); border:1px solid var(--border); padding:10px; border-radius:12px}
.deadline-list .badge{padding:2px 8px; border-radius:999px; font-size:12px}
.badge.success{background:var(--success)}
.badge.error{background:var(--error)}
.badge{padding:2px 8px; border-radius:999px; font-size:12px}
.badge.gray{background:#c9c7d7; color:#2b2933}
.badge.red{background:#F48585; color:#3a1010}
.badge.orange{background:#FFA559; color:#3a2310}
.badge.yellow{background:#FFE36E; color:#3a3510}
.badge.green{background:#85F485; color:#103a10}
.badge.blue{background:#8FB6FF; color:#0f234a}

.sep{width:1px; height:18px; background:var(--border); display:inline-block}

@media (max-width:900px){
  .card-row, .doc-grid{grid-template-columns:repeat(2, minmax(0,1fr))}
}
@media (max-width:600px){
  .card-row, .doc-grid{grid-template-columns:1fr}
}

/* Modal overlay styles (used by Templates modal) */
.modal-backdrop{
  position: fixed;
  inset: 0;
  background: color-mix(in hsl, var(--bg) 40%, black 60% / 40%);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}
.modal-backdrop[hidden]{
  display: none !important;
}
.modal-card{
  max-width: none;
  width: calc(100% - 48px);
  height: calc(100% - 48px);
  margin: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal-head{
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.modal-head h3{ margin: 0; }
.modal-body{
  padding: 16px;
  overflow: auto;
  flex: 1;
}
.templates-grid{
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

/* Template preview cards */
.template-card {
  display: block;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  transition: transform 0.2s, box-shadow 0.2s;
  color: var(--text);
  text-decoration: none;
}

.template-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  border-color: var(--primary);
}

.template-card strong {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 8px;
  display: block;
}

.template-card .preview {
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 12px;
  font-size: 12px;
  line-height: 1.4;
  height: 120px;
  overflow: hidden;
  color: var(--text-muted);
}

.template-card .preview h1, .template-card .preview h2 {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 8px;
  color: var(--text);
}

.template-card .preview p {
  margin: 0 0 4px;
}

.template-card .info {
  margin-top: 8px;
}

.template-card .info p {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .templates-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .templates-grid {
    grid-template-columns: 1fr;
  }
}

/* New styles for template modal with sidebar */
.modal-body-with-sidebar {
  display: flex;
  flex: 1;
  overflow: hidden;
  padding: 0;
}

.template-sidebar {
  width: 220px;
  background: var(--bg);
  border-right: 1px solid var(--border);
  padding: 16px;
  overflow-y: auto;
  flex-shrink: 0;
}

.template-sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.template-sidebar button {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--muted);
  text-align: left;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  font-size: 14px;
}

.template-sidebar button:hover {
  background: color-mix(in hsl, var(--primary) 10%, var(--surface));
  color: var(--text);
}

.template-sidebar button.active {
  background: var(--primary);
  color: white;
}

.templates-grid-container {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
}

.templates-grid .empty-state {
  color: var(--muted);
  text-align: center;
  padding: 40px;
  font-size: 14px;
}

/* Adjustments for template cards inside the new grid */
.template-card .info p {
  color: var(--muted);
}

.modal-body {
  padding: 0;
}
