/* Familjekalendern GUI. Colours, radii and type sizes follow the approved mockup (Veckovy PC / iPhone). */

:root {
  --ink: #1C1F26;
  --ink-2: #3B4252;
  --ink-3: #5B6270;
  --line: #E5E7EB;
  --line-2: #D4D7DE;
  --bg: #F4F5F7;
  --panel: #ffffff;
  --panel-2: #FAFAFB;
  --navy: #1F3A5F;
  --navy-2: #142640;
  --navy-tint: #E9EEF6;
  --today: #F7F3EA;
  --warn: #B4530A;
  --hour: 40px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif; font-size: 14px; }
[hidden] { display: none !important; }
a { color: var(--navy); }
a:hover { color: var(--navy-2); }
button { font: inherit; cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }

.app { min-height: 100vh; display: flex; flex-direction: column; }
.spacer { flex: 1 1 auto; }

/* Top bar */
.top { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 10px 20px; background: var(--panel); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; }
.tabs { display: flex; gap: 4px; }
.fk-tab { height: 40px; padding: 0 16px; border: 0; border-radius: 8px; background: transparent; font-weight: 500; color: var(--ink-2); }
.fk-tab.on { background: var(--navy-tint); color: var(--navy); font-weight: 600; }
.fk-btn { height: 44px; padding: 0 18px; border: 0; border-radius: 10px; background: var(--navy); color: #fff; font-weight: 600; display: inline-flex; align-items: center; gap: 8px; }
.fk-btn:hover:not(:disabled) { background: var(--navy-2); }
.fk-ghost { height: 44px; min-width: 44px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--panel); color: var(--ink); font-weight: 500; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.fk-ghost:hover:not(:disabled) { background: var(--panel-2); }

/* Week navigation + legend */
.subbar { display: flex; align-items: center; gap: 10px; padding: 12px 20px 0; flex-wrap: wrap; }
.title { margin: 0 0 0 8px; font-size: 20px; font-weight: 700; }
.title span { font-weight: 400; color: var(--ink-3); }
.legend { display: flex; gap: 10px; flex-wrap: wrap; font-size: 12px; color: var(--ink-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; border: 1px solid; vertical-align: -1px; margin-right: 4px; }

/* Member areas */
.areas { display: flex; gap: 16px; padding: 12px 20px 16px; flex-wrap: wrap; align-items: flex-start; }
.area { flex: 1 1 400px; min-width: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.area-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.avatar { width: 34px; height: 34px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; flex: none; }
.area-head h2 { margin: 0; font-size: 17px; font-weight: 700; }
.area-head .src { font-size: 12px; color: var(--ink-3); }
.area-head .err { font-size: 12px; color: var(--warn); font-weight: 600; margin-left: auto; }
.grid-scroll { overflow-x: auto; overflow-y: hidden; }
.grid-inner { min-width: 0; }
.row { display: grid; grid-template-columns: 48px repeat(7, minmax(0, 1fr)); }
.row.heads { border-bottom: 1px solid var(--line); }
.row.allday { border-bottom: 1px solid var(--line); min-height: 44px; background: var(--panel-2); }
.allday-label { font-size: 10px; color: var(--ink-3); padding: 6px 6px 0 0; text-align: right; }
.allday-col { border-left: 1px solid var(--line); padding: 2px; display: flex; flex-direction: column; min-width: 0; }
.fk-dayhead { font-size: 12px; font-weight: 600; color: var(--ink-3); text-align: center; padding: 8px 0 6px; }
.fk-dayhead b { display: block; font-size: 16px; color: var(--ink); font-weight: 700; }
.fk-dayhead.today b { display: inline-block; background: var(--navy); color: #fff; border-radius: 999px; min-width: 28px; line-height: 28px; }
.hours { padding-top: 0; }
.fk-hour { font-size: 11px; color: var(--ink-3); text-align: right; padding-right: 6px; height: var(--hour); transform: translateY(-6px); }
.fk-daycol { position: relative; border-left: 1px solid var(--line); background-image: repeating-linear-gradient(to bottom, var(--line) 0 1px, transparent 1px var(--hour)); }
.fk-daycol.today { background-color: var(--today); }
.fk-ev { position: absolute; left: 3px; right: 3px; border-radius: 6px; padding: 4px 6px; font-size: 11px; line-height: 1.25; overflow: hidden; border: 1px solid; text-align: left; display: block; width: auto; }
.fk-ev b { display: block; font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fk-ev:hover, .fk-chip:hover { filter: brightness(.96); }
.fk-ev:focus-visible, .fk-chip:focus-visible { outline: 2px solid var(--navy); outline-offset: 1px; }
.fk-chip { display: inline-block; border-radius: 6px; padding: 3px 6px; font-size: 11px; font-weight: 600; border: 1px solid; margin: 2px; text-align: left; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fk-mark { position: absolute; right: 4px; top: 4px; display: flex; gap: 3px; }
.fk-svara { background: var(--warn); color: #fff; font-size: 10px; font-weight: 700; border-radius: 999px; padding: 1px 6px; line-height: 14px; }
.tag { display: inline-block; font-size: 9px; font-weight: 700; letter-spacing: .02em; border-radius: 4px; padding: 0 4px; line-height: 14px; margin-right: 4px; vertical-align: 1px; background: rgba(255,255,255,.75); border: 1px solid currentColor; }
.empty { padding: 28px 14px; text-align: center; color: var(--ink-3); font-size: 13px; }

/* Activity card */
.card { position: fixed; width: 320px; max-width: calc(100vw - 20px); background: var(--panel); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: 0 12px 32px rgba(20,25,40,.18); padding: 14px; display: flex; flex-direction: column; gap: 10px; z-index: 20; }
.card-head { display: flex; align-items: flex-start; gap: 8px; }
.card-sw { width: 12px; height: 12px; border-radius: 3px; border: 1px solid; margin-top: 4px; flex: none; }
.card-title { font-weight: 700; font-size: 15px; }
.card-when { font-size: 13px; color: var(--ink-2); }
.card-meta { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.card-close { height: 32px; min-width: 32px; padding: 0; margin-left: auto; }
.card-notes { font-size: 13px; color: var(--ink-2); white-space: pre-wrap; border-top: 1px solid var(--line); padding-top: 10px; max-height: 160px; overflow: auto; }
.card-comment { font-size: 13px; border-top: 1px solid var(--line); padding-top: 10px; }
.card-comment label { display: block; font-size: 12px; font-weight: 600; color: var(--ink-2); margin-bottom: 4px; }
.card-answer { display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: #FFF4EA; border: 1px solid #F0C8A3; border-radius: 8px; font-size: 13px; color: #7A3A08; }
.card-link { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; border-radius: 10px; background: var(--navy); color: #fff; font-weight: 600; text-decoration: none; }
.card-hint { font-size: 12px; color: var(--ink-3); }

.fk-mark-inline { display: inline-flex; gap: 3px; margin-left: 4px; vertical-align: -2px; }
.card-row { display: flex; gap: 8px; margin-top: 6px; }
.card-row input { flex: 1; height: 40px; border: 1px solid var(--line-2); border-radius: 8px; padding: 0 10px; font: inherit; font-size: 13px; min-width: 0; }
.card-row .fk-ghost { height: 40px; }
.card-actions { display: flex; gap: 8px; border-top: 1px solid var(--line); padding-top: 10px; }
.card-actions .fk-ghost { height: 40px; flex: 1; }
.fk-ghost.danger { color: #B42318; border-color: #F0C8C3; }
.fk-ghost.danger:hover:not(:disabled) { background: #FFF4F2; }

/* Month view (mockup "Månadsvy – PC") */
.m-head { display: flex; border-bottom: 1px solid var(--line); background: var(--panel-2); }
.m-days { flex: 1; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.m-dh { font-size: 11px; font-weight: 600; color: var(--ink-3); text-align: center; padding: 7px 0; }
.m-row { display: flex; border-bottom: 1px solid var(--line); }
.m-grid { flex: 1; position: relative; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); min-height: 86px; }
.fk-wn { width: 36px; flex: none; font-size: 11px; font-weight: 600; color: var(--ink-3); display: flex; align-items: flex-start; justify-content: center; padding-top: 7px; background: var(--panel-2); border-right: 1px solid var(--line); }
.fk-cell { border-left: 1px solid var(--line); padding: 4px; min-width: 0; display: flex; flex-direction: column; gap: 2px; cursor: pointer; }
.fk-cell:first-child { border-left: 0; }
.fk-cell.dim { background: #F7F7F8; color: #9AA0AB; }
.fk-cell.dim .n { color: #9AA0AB; }
.fk-cell .n { font-size: 12px; font-weight: 600; border-radius: 999px; width: 22px; line-height: 22px; text-align: center; flex: none; }
.fk-cell.today .n { background: var(--navy); color: #fff; }
.fk-lbl { font-size: 10px; font-weight: 600; border-radius: 4px; padding: 1px 5px; border: 1px solid; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 3px; text-align: left; max-width: 100%; cursor: pointer; }
.fk-lbl .fk-svara { font-size: 9px; padding: 0 5px; line-height: 13px; flex: none; }
.fk-lbl .tag { margin-right: 0; flex: none; }
.fk-lbl .lbl-c { flex: none; margin-left: auto; }
.fk-bar { position: absolute; height: 18px; border-radius: 4px; border: 1px solid; font-size: 10px; font-weight: 600; padding: 0 6px; line-height: 16px; white-space: nowrap; overflow: hidden; text-align: left; cursor: pointer; }
.fk-bar .tag { line-height: 12px; }

/* Manual-entry form */
.modal { position: fixed; inset: 0; background: rgba(20,25,40,.35); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 40; }
.form-box { width: 100%; max-width: 420px; max-height: calc(100vh - 32px); overflow: auto; background: var(--panel); border: 1px solid var(--line-2); border-radius: 12px; padding: 18px; display: flex; flex-direction: column; gap: 10px; box-shadow: 0 12px 32px rgba(20,25,40,.18); }
.form-box h2 { margin: 0 0 4px; font-size: 17px; }
.form-box .f { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: var(--ink-2); }
.form-box .f.check { flex-direction: row; align-items: center; gap: 8px; }
.form-box input[type=text], .form-box input[type=date], .form-box input[type=datetime-local], .form-box select, .form-box textarea { height: 40px; border: 1px solid var(--line-2); border-radius: 8px; padding: 0 10px; font: inherit; font-size: 14px; font-weight: 400; color: var(--ink); background: #fff; }
.form-box textarea { height: auto; padding: 8px 10px; resize: vertical; }
.form-box input[type=checkbox] { width: 18px; height: 18px; }
.form-error { min-height: 16px; font-size: 13px; color: #B42318; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; }

/* Footer */
.foot { margin-top: auto; padding: 10px 20px; background: var(--panel); border-top: 1px solid var(--line); font-size: 12px; color: var(--ink-2); display: flex; gap: 18px; flex-wrap: wrap; }
.foot .warn { color: #7A3A08; font-weight: 600; }

/* Login */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-box { width: 100%; max-width: 360px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 24px; display: flex; flex-direction: column; gap: 12px; }
.login-box label { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.login-box input { height: 44px; border: 1px solid var(--line-2); border-radius: 8px; padding: 0 12px; font: inherit; }
.login-error { min-height: 18px; font-size: 13px; color: #B42318; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 14px; border-radius: 10px; font-size: 13px; z-index: 30; max-width: calc(100vw - 40px); }

/* iPhone: areas stack, grids scroll sideways, smaller type (mockup Veckovy iPhone). */
@media (max-width: 700px) {
  :root { --hour: 32px; }
  .top { gap: 10px; padding: 10px 14px; }
  .brand { font-size: 16px; }
  .brand svg { width: 24px; height: 24px; }
  .tabs { order: 10; width: 100%; }
  .fk-tab { height: 36px; padding: 0 14px; font-size: 13px; }
  .fk-btn { padding: 0 14px; font-size: 13px; }
  #logout { display: none; }
  .subbar { padding: 8px 14px 0; gap: 8px; }
  .title { font-size: 15px; margin: 0; flex: 1; text-align: center; order: 1; white-space: nowrap; }
  #prev { order: 0; } #next { order: 2; } #today { order: 3; }
  .legend { order: 4; width: 100%; }
  .areas { flex-direction: column; gap: 12px; padding: 10px 10px 12px; }
  .area { flex: none; width: 100%; }
  .grid-inner { min-width: 560px; }
  .row { grid-template-columns: 34px repeat(7, minmax(0, 1fr)); }
  .fk-dayhead { font-size: 10px; padding: 6px 0 4px; }
  .fk-dayhead b { font-size: 14px; }
  .fk-dayhead.today b { min-width: 24px; line-height: 24px; }
  .fk-hour { font-size: 10px; padding-right: 4px; }
  .fk-ev { padding: 3px 4px; font-size: 9px; left: 2px; right: 2px; }
  .fk-ev b { font-size: 10px; }
  .fk-chip { font-size: 9px; padding: 2px 4px; }
  .card { left: 10px !important; right: 10px; top: auto !important; bottom: 10px; width: auto; }
  .m-grid { min-height: 72px; }
  .fk-wn { width: 28px; }
  .fk-lbl { font-size: 9px; }
  .foot { padding: 10px 14px; font-size: 11px; flex-direction: column; gap: 3px; }
}
