body { font-family: system-ui, Arial, sans-serif; margin: 2rem; }
label { margin-right: 1rem; }
canvas { width: 100%; max-width: 1000px; height: 420px; }


        :root{
          --card-bg:#ffffff;
          --text:#0f172a;
          --muted:#64748b;
          --border:#e2e8f0;
          --primary:#111827;      /* knappfärg */
          --primary-focus:#0b1220;/* hover */
          --accent:#6366f1;       /* fokusglöd */
        }

        /* Centrera allt */
        html, body { height: 100%; }
        body{
          margin:0;
          display:flex;
          align-items:center;
          justify-content:center;
          min-height:100dvh;      /* mobilvänligt */
          font-family: system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji";
          background: linear-gradient(180deg, #f8fafc, #eef2ff);
          color:var(--text);
        }

        /* Kortet */
        .login-card{
          width:100%;
          max-width:430px;
          background:var(--card-bg);
          padding:28px;
          border-radius:20px;
          box-shadow: 0 10px 30px rgba(0,0,0,.08);
        }

        .login-card h1{
          margin:0 0 8px 0;
          font-size:1.4rem;
          font-weight:700;
        }
        .login-card p.sub{
          margin:0 0 18px 0;
          color:var(--muted);
          font-size:2rem;
          text-align: center;
          font-weight:1000;
        }

        .field{
          margin-bottom:14px;
        }
        .field label{
          display:block;
          font-weight:600;
          margin-bottom:6px;
          margin-top: 20 px;
        }

        /* Ovala fält */
        .oval-input{
          width:100%;
          padding:14px 18px;
          border:1px solid var(--border);
          border-radius:9999px;           /* <- gör fältet ovalt */
          outline:none;
          background:#fff;
          transition:border-color .2s, box-shadow .2s;
          font-size:1rem;
        }
        .oval-input:focus{
          border-color:var(--accent);
          box-shadow:0 0 0 4px rgba(99,102,241,.15);
        }

        /* Oval knapp */
        .oval-btn{
          width:100%;
          padding:14px 18px;
          border:none;
          border-radius:9999px;
          background:var(--primary);
          color:#fff;
          font-weight:700;
          cursor:pointer;
          transition:background .2s, transform .02s, box-shadow .2s;
          margin-top: 30px;
        }
        .oval-btn:hover{ background:var(--primary-focus); }
        .oval-btn:active{ transform:translateY(1px); }
        /* Gör 100% till "ytterbredd" så kanter/padding räknas in */
        *, *::before, *::after { box-sizing: border-box; }

        /* Samma block- och breddbeteende för både fält och knapp */
        .oval-input,
        .oval-btn {
            display: block;
            width: 100%;
        }
        /* Små hjälplänkar/text under knappen (valfritt) */
        .hint{
          margin-top:14px;
          text-align:center;
          color:var(--muted);
          font-size:.9rem;
        }

        /* OAuth login button */
        .oauth-btn {
            display: block;
            width: 100%;
            padding: 14px 18px;
            border: 1px solid var(--border);
            border-radius: 9999px;
            background: #fff;
            color: var(--text);
            font-weight: 600;
            text-decoration: none;
            text-align: center;
            cursor: pointer;
            transition: background .2s, transform .02s, box-shadow .2s;
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
        }
        .oauth-btn:hover {
            background: #f8fafc;
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
        }
        .oauth-btn:active {
            transform: translateY(1px);
        }

        /* Page layout with sidebar */
        .page-container {
            display: flex;
            gap: 2rem;
            max-width: 1800px;
            margin: 0 auto;
            padding: 2rem;
        }

        .main-content {
            flex: 1;
            min-width: 0; /* Allows flexbox to shrink below content size */
        }

        .calendar-sidebar {
            width: 750px;
            background: var(--card-bg);
            border: 1px solid var(--border);
            border-radius: 12px;
            padding: 1.5rem;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
            align-self: flex-start; /* Stick to top */
            position: sticky;
            top: 2rem;
            max-height: calc(100vh - 4rem);
            overflow-y: auto;
        }

        .calendar-sidebar h3 {
            margin: 0 0 1rem 0;
            font-size: 1.1rem;
            font-weight: 700;
            color: var(--primary);
        }

        #calendarView {
            display: flex;
            flex-direction: row;
            gap: 1rem;
        }

        .calendar-day-timeline {
            flex: 1;
            min-width: 300px;
            background: #fff;
            border-radius: 8px;
            overflow: hidden;
            box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
        }

        .day-header {
            font-weight: 700;
            font-size: 0.95rem;
            color: #fff;
            background: var(--accent);
            padding: 0.75rem 1rem;
            text-transform: capitalize;
        }

        .timeline-container {
            display: flex;
            min-height: 600px;
            position: relative;
        }

        .time-labels {
            width: 50px;
            background: #f8fafc;
            border-right: 2px solid var(--border);
            flex-shrink: 0;
        }

        .time-label {
            height: 50px;
            display: flex;
            align-items: flex-start;
            justify-content: center;
            font-size: 0.7rem;
            color: var(--muted);
            font-weight: 600;
            padding-top: 2px;
            border-bottom: 1px solid var(--border);
        }

        .events-area {
            flex: 1;
            position: relative;
            background: #fff;
        }

        .time-grid {
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            height: 100%;
            pointer-events: none;
        }

        .hour-line {
            height: 50px;
            border-bottom: 1px solid #e2e8f0;
        }

        .hour-line:nth-child(even) {
            background: #fafbfc;
        }

        .timeline-event {
            position: absolute;
            background: linear-gradient(135deg, #6366f1 0%, #818cf8 100%);
            border-left: 3px solid #4f46e5;
            border-radius: 4px;
            padding: 6px 8px;
            box-shadow: 0 2px 6px rgba(99, 102, 241, 0.3);
            overflow: hidden;
            cursor: pointer;
            transition: box-shadow 0.2s, transform 0.2s;
        }

        .timeline-event:hover {
            box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
            transform: scale(1.02);
            z-index: 1000 !important;
        }

        .timeline-event-time {
            font-size: 0.7rem;
            color: rgba(255, 255, 255, 0.95);
            font-weight: 700;
            margin-bottom: 2px;
            text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
        }

        .timeline-event-title {
            font-size: 0.8rem;
            font-weight: 600;
            color: #fff;
            line-height: 1.3;
            margin-bottom: 2px;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .timeline-event-description {
            font-size: 0.7rem;
            color: rgba(255, 255, 255, 0.85);
            line-height: 1.3;
            overflow: hidden;
            text-overflow: ellipsis;
            display: -webkit-box;
            -webkit-line-clamp: 2;
            -webkit-box-orient: vertical;
        }

        .loading,
        .no-events,
        .error {
            text-align: center;
            padding: 1rem;
            color: var(--muted);
            font-size: 0.9rem;
        }

        .error {
            color: #dc2626;
            background: #fee2e2;
            border-radius: 6px;
        }

        /* Responsive design */
        @media (max-width: 1024px) {
            .page-container {
                flex-direction: column;
            }

            .calendar-sidebar {
                width: 100%;
                position: static;
                max-height: none;
            }

            #calendarView {
                flex-direction: column;
            }

            .calendar-day-timeline {
                min-width: unset;
            }
        }

