:root {
  --bg: #f5f5f7;
  --card: #ffffff;
  --text: #1d1d1f;
  --muted: #6e6e73;
  --accent: #007aff;
  --shadow: 0 8px 24px rgba(0,0,0,0.08);
  --radius: 16px;
}

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

.hidden { display: none !important; }

.app-header {
  position: sticky;
  top: 0;
  backdrop-filter: saturate(180%) blur(12px);
  background: rgba(255,255,255,0.7);
  border-bottom: 1px solid rgba(0,0,0,0.06);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 10;
}
.brand { font-weight: 600; letter-spacing: 0.2px; }
.menu-btn { border: none; background: transparent; cursor: pointer; }
.menu-btn i { width: 24px; height: 24px; }
.menu-dropdown { position: absolute; right: 16px; top: 54px; background: var(--card); box-shadow: var(--shadow); border-radius: 12px; overflow: hidden; display: grid; z-index: 100; opacity: 0; transform: translateY(-6px) scale(0.98); transition: opacity 180ms ease, transform 180ms ease; pointer-events: none; }
.menu-dropdown.show { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
.menu-dropdown a { padding: 10px 14px; text-decoration: none; color: var(--text); white-space: nowrap; }
.menu-dropdown a:hover { background: rgba(0,0,0,0.04); }

.app-main { max-width: 1080px; margin: 24px auto; padding: 0 16px; }

.list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 640px) {
  .list { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 960px) {
  .list { grid-template-columns: repeat(3, 1fr); }
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card .info { display: flex; flex-direction: column; gap: 4px; }
.card .name { font-weight: 600; }
.card .days { color: var(--muted); font-size: 14px; }

.inline {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn {
  appearance: none;
  border: none;
  background: var(--accent);
  color: #fff;
  padding: 10px 14px;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
}
.btn:active { transform: translateY(1px); }

.modal.hidden { display: none; }
.modal { position: fixed; inset: 0; display: grid; place-items: center; z-index: 50; opacity: 0; transition: opacity 200ms ease; pointer-events: none; }
.modal.open { opacity: 1; pointer-events: auto; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.2); opacity: 0; transition: opacity 200ms ease; }
.modal.open .modal-backdrop { opacity: 1; }
.modal-panel {
  position: relative;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  width: min(640px, calc(100vw - 32px));
  transform: translateY(8px) scale(0.98);
  transition: transform 200ms ease, opacity 200ms ease;
  opacity: 0;
}
.modal.open .modal-panel { transform: translateY(0) scale(1); opacity: 1; }
.close { position: absolute; right: 14px; top: 10px; border: none; background: transparent; font-size: 24px; cursor: pointer; }
.detail { display: grid; gap: 12px; }
.detail h2 { margin: 0; font-size: 22px; }
.detail-row { display: flex; align-items: center; justify-content: space-between; color: var(--text); }
.detail-row span:first-child { color: var(--muted); }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; border-radius: 999px; font-weight: 600; font-size: 12px; }
.badge svg { width: 16px; height: 16px; }
.badge--normal { color: #1e7f39; background: #eaf8ef; }
.badge--warning { color: #9a5b00; background: #fff3e1; }
.badge--urgent { color: #a61b1b; background: #ffe9e9; }

/* Config page layout */
.config-card { width: min(640px, 100%); margin: 24px 0 0 0; padding: 24px; }
.config-card label { display: block; width: 100%; margin-bottom: 12px; }
.cfg-input { width: 100%; padding: 12px; border-radius: 12px; border: 1px solid rgba(0,0,0,0.1); }

/* Floating refresh button */
.fab { position: fixed; right: 20px; bottom: 20px; z-index: 120; width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: #fff; border: none; box-shadow: var(--shadow); cursor: pointer; }
.fab i { width: 22px; height: 22px; }
.fab:active { transform: translateY(1px); }

/* Loader */
.loader { display: flex; align-items: center; gap: 10px; justify-content: center; padding: 24px; color: var(--muted); }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
