:root {
  --muted-border-color: #f4f4f6;
}

/* Planner grid and basic layout */
.k-grid {
  display: grid;
  /* give the left column more space so Top 3 blocks are wider */
  grid-template-columns: 1.6fr 1fr;
  gap: 1rem;
}

/* Make the left planner section as wide as possible (span grid) */
#planner-left {
  grid-column: 1 / -1; /* span all columns, pushes right column below */
  width: 100%;
  box-sizing: border-box;
}

@media (min-width: 980px) {
  /* On larger screens, keep left section spanning both columns to maximize width */
  #planner-left {
    grid-column: 1 / -1;
  }
}
.row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.num {
  width: 2rem;
  text-align: right;
  color: #888;
  font-weight: 600;
}
.clock {
  width: 3.5rem;
  font-variant-numeric: tabular-nums;
  color: #666;
}
.mono {
  font-family:
    ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
    "Courier New", monospace;
}
.muted {
  color: #666;
}
.readonly {
  padding: 0.5rem 0.75rem;
  background: var(--muted-border-color, #f4f4f6);
  border-radius: 0.5rem;
  min-height: 2rem;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.icon-btn {
  border: none;
  background: transparent;
  cursor: pointer;
  color: #555;
}
.icon {
  font-style: normal;
}

/* Make form controls fluid and prevent overflow */
input[type="text"],
textarea {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

/* Responsive: stack sections on smaller screens */
@media (max-width: 980px) {
  .k-grid {
    grid-template-columns: 1fr;
  }
}

/* Tweak spacing and sizes for very small screens (10" tablets/phones) */
@media (max-width: 480px) {
  .num {
    width: 1.6rem;
  }
  .clock {
    width: 3rem;
    font-size: 0.95rem;
  }
  .readonly,
  input[type="text"],
  textarea {
    font-size: 0.95rem;
    padding: 0.4rem 0.6rem;
  }
  h1,
  h3 {
    font-size: 1.1rem;
  }
}

/* Top3 specific styles */
.top3-list {
  /* behave like a block list but we'll render custom card items */
  display: block;
  /* explicitly remove native list numbering to avoid duplicate numbers */
  list-style: none !important;
  padding-left: 0 !important;
  margin: 0 0 0.75rem 0;
  width: 100%;
  box-sizing: border-box;
}
.top3-item {
  display: block; /* legacy, cards now use .top3-card */
}

/* New Top3 card layout */
.top3-card-wrap {
  margin: 0 0 0.6rem 0;
}
.top3-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: transparent;
  padding: 0.6rem 0.75rem;
  border-radius: 0.5rem;
  box-sizing: border-box;
}
.top3-card-checkbox {
  margin: 0;
  display: inline-flex;
  align-items: center;
}
.top3-card-num {
  width: 2em;
  text-align: right;
  color: #cfd8dc; /* light text for numbers */
  font-weight: 600;
}
.top3-card-content {
  flex: 1;
  min-width: 0;
}
.top3-card-text,
.top3-text,
.top3-item .text {
  display: block;
  overflow-wrap: anywhere;
  word-break: break-word;
  color: #fff !important; /* white text on site background */
}
.top3-checkbox {
  margin-top: 0;
  align-self: center;
}
.top3-main-wrap {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex: 1 1 auto;
}
.top3-num {
  width: 2em;
  text-align: right;
  font-weight: 600;
  color: inherit;
  opacity: 0.8;
  font-size: 1.05em;
  margin-right: 0.5rem;
  display: inline-block;
  vertical-align: middle;
}
.top3-texts {
  flex: 1 1 auto;
  min-width: 0;
}
/* Strong overrides to prevent per-character vertical layout */
.top3-texts,
.top3-texts * {
  white-space: normal !important;
  word-break: normal !important;
  overflow-wrap: normal !important;
  writing-mode: horizontal-tb !important;
  text-orientation: mixed !important;
  letter-spacing: normal !important;
  transform: none !important;
}
.top3-title,
.top3-desc {
  display: block !important;
  max-width: 100% !important;
  vertical-align: middle !important;
  text-align: left !important;
  overflow-wrap: anywhere !important;
  word-break: break-word !important;
  font-size: 0.98rem;
  line-height: 1.25;
}
.top3-item.done .top3-title,
.top3-item.done .top3-desc {
  text-decoration: line-through;
  color: #888;
}
.top3-input {
}

/* Header / global styles moved from header.php */
:root {
  --font-family:
    Inter, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial,
    "Apple Color Emoji", "Segoe UI Emoji";
}
body {
  font-family: var(--font-family);
}
.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 1rem;
  box-sizing: border-box;
}
.grid {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 1rem;
}
textarea {
  height: 160px;
}

/* Utility helpers to replace inline styles */
.text-center {
  text-align: center;
}
.no-margin {
  margin: 0 !important;
}
.inline-form {
  margin: 0 !important;
  display: inline-block !important;
}
.flex-grow {
  flex: 1 !important;
}
.mt-1 {
  margin-top: 1rem !important;
}
.mt-075 {
  margin-top: 0.75rem !important;
}
.mt-05 {
  margin-top: 0.5rem !important;
}
.controls {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}
.small-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem 0.5rem;
  font-size: 0.85rem;
  line-height: 1;
  border-radius: 0.25rem;
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.06);
  cursor: pointer;
  width: auto;
  flex: 0 0 auto;
}

/* Prevent buttons from stretching inside .row flex containers */
.row > button,
.row > .small-btn,
.row > a.small-btn {
  width: auto;
}

/* Basic Bootstrap-like button utilities (small subset) */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.375rem 0.75rem;
  font-size: 1rem;
  line-height: 1.5;
  border-radius: 0.25rem;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover {
  opacity: 0.95;
}
.btn:active {
  transform: translateY(0.5px);
}

.btn-primary {
  background-color: #0d6efd;
  color: #fff;
  border-color: #0d6efd;
}
.btn-primary:hover {
  background-color: #0b5ed7;
  border-color: #0b5ed7;
}

.btn-secondary {
  background-color: #6c757d;
  color: #fff;
  border-color: #6c757d;
}
.btn-secondary:hover {
  background-color: #5c636a;
  border-color: #5c636a;
}

/* small variant for compact buttons */
.btn.small-btn {
  padding: 0.25rem 0.5rem;
  font-size: 0.85rem;
}
.hidden {
  display: none !important;
}
.justify-start {
  justify-content: flex-start !important;
}
.text-white {
  color: #fff !important;
}
.done-text {
  text-decoration: line-through;
  color: #888 !important;
}

.top3-wrap {
  max-width: none;
  width: 100%;
  margin: 1rem 0;
}
.top3-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.top3-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  background: transparent !important;
  border-radius: 0rem;
}
.top3-item .text {
  flex: 1;
}
.center-actions {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

/* Today view: show plain, non-editable output — no white boxes, white text on dark background */
.today-wrap {
  color: #fff; /* white text for readability on dark site background */
}
.today-wrap .readonly,
.today-wrap .top3-item,
.today-wrap .top3-card,
.today-wrap .top3-card-wrap,
.today-wrap .top3-card-content {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  min-height: 0 !important;
  border-radius: 0 !important;
}
.today-wrap .top3-num,
.today-wrap .top3-card-num,
.today-wrap .clock {
  color: #cfd8dc !important;
}
.today-wrap .muted {
  color: #b0bec5 !important;
}
.today-wrap h2 {
  color: #fff !important;
  margin-bottom: 0.5rem;
}
.today-wrap .top3-list {
  gap: 0.4rem;
}
.today-wrap .top3-item .top3-text,
.today-wrap .readonly,
.today-wrap .top3-card-text {
  color: #fff !important;
  display: block;
}

/* Ensure schedule rows do not show white panels */
.today-wrap .row {
  gap: 0.75rem;
  align-items: flex-start;
}

/* Planner read-only styling: apply same plain output look to the left planner column */
#planner-left {
  color: #fff;
}
#planner-left .readonly,
#planner-left .top3-item,
#planner-left .top3-card,
#planner-left .top3-card-wrap,
#planner-left .top3-card-content {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  min-height: 0 !important;
  border-radius: 0 !important;
}
#planner-left .top3-card-num,
#planner-left .top3-num,
#planner-left .clock {
  color: #cfd8dc !important;
}
#planner-left .muted {
  color: #b0bec5 !important;
}
#planner-left h3,
#planner-left h2 {
  color: #fff !important;
}
#planner-left .top3-card-text,
#planner-left .top3-text,
#planner-left .top3-item .text,
#planner-left .readonly {
  color: #fff !important;
  display: block;
}
#planner-left .row {
  gap: 0.75rem;
  align-items: flex-start;
}

/* Force dark theme regardless of system preference or Pico defaults */
:root {
  color-scheme: dark;
  --muted-border-color: #1f2937; /* darker muted color for inputs/readonly */
}

html,
body {
  background-color: #071023 !important; /* deep dark navy */
  color: #e6eef6 !important; /* slightly off-white for better readability */
}

/* Make form controls and panels follow dark background */
input,
textarea,
select,
button,
.readonly {
  background: transparent !important;
  color: inherit !important;
  border-color: rgba(255, 255, 255, 0.06) !important;
}

a {
  color: #7ecbff; /* calmer light-blue for links */
  text-decoration: underline;
}

a:visited {
  color: #6aaed6;
}

a:hover,
a:focus {
  color: #bfeeff;
  text-decoration: underline;
}
.btn-primary {
  background-color: #0d6efd;
  border-color: #0d6efd;
}

/* Reduce strong white backgrounds from Pico by targeting common utility classes */
.container,
main,
.grid {
  background: transparent !important;
}

/* Navbar improvements (better layout and touch behavior for Safari)
   - ensure valid flex layout and wrapping for small widths
   - make links touch-friendly and remove tap-highlight
   - add minimal translucent background to prevent flash on load
*/
nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.25rem 0.5rem;
  background: rgba(7, 16, 35, 0.6);
  position: relative;
  z-index: 50;
  -webkit-font-smoothing: antialiased;
  -webkit-overflow-scrolling: touch;
  -webkit-transform: translateZ(0);
}

nav > ul {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin: 0;
  padding: 0;
  list-style: none;
  flex-wrap: wrap;
}

nav li {
  list-style: none;
}

nav a,
nav button {
  display: block;
  padding: 0.45rem 0.6rem;
  color: inherit;
  text-decoration: none;
  border-radius: 0.25rem;
  -webkit-appearance: none;
  -webkit-tap-highlight-color: transparent;
}

nav a:focus,
nav a:hover,
nav button:focus,
nav button:hover {
  outline: none;
  background: rgba(255, 255, 255, 0.03);
}

/* Ensure nav children don't overflow/clip in Safari flex layouts */
nav * {
  min-width: 0;
}

/* Ensure subtle separators are visible on dark background */
hr {
  border-color: rgba(255, 255, 255, 0.06) !important;
}
